Skip to content

Raise error when guard fails #149

@choubacha

Description

@choubacha

I'm not sure this falls inline with your design but I was expecting a guard method to raise an exception when it failed, much like invalid transitions raise errors.

Personally, I don't like a mixture of functionality, either fail hard or use the return value. With guards I need to check the return value (I think) and with invalid state transitions I need to rescue an exception.

Since guards can be multiple response, an exception might be the best solution since it can carry with it which guards failed. This is especially useful for sharing failure state with the end user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions