Skip to content

Exceptionhandling in guards #608

Open
@vghero

Description

@vghero

Actions seem to support error handling from which I can set machine error state and even the occurred exception in the extended state to evaluate it at the caller. That's fine.

Now I started to play with Guards and it seems they don't have an exception handling, which seems by design. Any error is catched and false is returned. On first sight, that might make sense, but in combination with Choice, that leads to unwanted results.

E.g. I have a Choice, where a Guard is called. When the result is true it calls my action, if it is false it simply transitions to another state (else). When now an error occurs in the Guard (e.g. I did a NPE on accident), it results to false moving the machine into a state, I don't want it to be. Since it was a technical error that should not do any transition at all but set the machine to an error state (or at least provide a callback to do so). But maybe I'm missing something here?

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