You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am experimenting with the Service with State (aggregate-less) and I really like the fluent syntax and experience.
There are, however, two scenarios I am not too convinced about.
If there is a non exceptional case such as invariants being protected in order to reject a command (e.g: the command attempts to write one thing, but the current state and business rules should prevent it and reject it), I have to throw an exception that will be handled by the internal eventuous' base handler and transformed into a Result.Error
That's ok, but it forces us to define and use Exceptions for flow control and domain un-exceptional errors. Is there any other recommended alternative?
If there is a need to capture domain events that are for "negative" scenarios but still useful to capture, such as BidAttempted in a bidding domain where a bid could be rejected but the attempt stored, we may need to discriminate domain events in order to return an error from application or http layer instead of returning success, as it would have if the event was BidPlaced or similar. There are probably many ways to tackle this with Eventuous by examining the successful Result, but I'm interested in knowing if anyone else have had these needs and how they approached them.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am experimenting with the Service with State (aggregate-less) and I really like the fluent syntax and experience.
There are, however, two scenarios I am not too convinced about.
If there is a non exceptional case such as invariants being protected in order to reject a command (e.g: the command attempts to write one thing, but the current state and business rules should prevent it and reject it), I have to throw an exception that will be handled by the internal eventuous' base handler and transformed into a Result.Error
That's ok, but it forces us to define and use Exceptions for flow control and domain un-exceptional errors. Is there any other recommended alternative?
If there is a need to capture domain events that are for "negative" scenarios but still useful to capture, such as BidAttempted in a bidding domain where a bid could be rejected but the attempt stored, we may need to discriminate domain events in order to return an error from application or http layer instead of returning success, as it would have if the event was BidPlaced or similar. There are probably many ways to tackle this with Eventuous by examining the successful Result, but I'm interested in knowing if anyone else have had these needs and how they approached them.
As always, great library!
Beta Was this translation helpful? Give feedback.
All reactions