Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Using
Result
encourages explicit handling of errors, making your code more predictable and robust. Unlike exceptions, which can propagate invisibly,Result
types must be explicitly handled using pattern matching or methods likeunwrap()
. This explicit handling ensures that every possible error is accounted for, which reduces unexpected behaviors and crashes in production.Decider just got a new generic param
Error
defaulting to Unit (()
)With this change, the
decide
function now returns a Result, wrapping the vector of events. Events are modeled as enums (following a sum type relationship), allowing for the representation of domain-specific error events. This design choice means that errors can be returned immediately as an Err variant rather than being expressed as events that need to be stored. It gives more options in handling error scenarios!THIS IS A BREAKING CHANGE -
Decider.decide
is affected.