Replies: 1 comment
-
|
Imo when an invariant isn't satisfied, it's a bad request, so the result is returned as such. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
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