Skip to content

Return an error instead of panicking when finalizing builders #652

Closed
@dbanty

Description

@dbanty

Specifically, I followed this example in order to create an Azure Blob SAS in tests, but didn't bother adding an expiration because I didn't realize it was required. Calling finalize() resulted in a panic due to this line. It would be a better experience to return a Result from finalize so it's clear that it's fallible and that some steps may be required.

Alternatively, it could fail during compilation either by using types to track which of the required steps have been completed or by putting the required parameters in the initial constructor function. That may be an even easier experience for consumers but I suspect is more work to add to the API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions