-
-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Differentiate application exceptions #83
Comments
I know the command service does not throw exceptions and instead returns Result. |
TL;DR Forcing people into the Result pattern invariably makes a mess, regardless of the language and idioms that generally apply in a consumption context. Remove! Infra errors should throw, and decision function's should return BOTH: |
I talked to Jérémie about it some time ago. He said the domain model should throw as the request was invalid and it should be explicit. Essentially, from the API side it will result in 400. That's what Eventuous HTTP API is doing. The requirement is that the model needs to throw a |
Related to #77
@thomaseyde describes that the application service fails when handling a command when an event stream contains an unknown event. Currently, the app service returns an
ErrorResult
where the exception is "unknown event type".The reason for the app service to return an
ErrorResult
in the first place was to convey domain-level errors to the caller. However, things like "event store is down" or "unknown event type" are different types of errors as they indicate technical failures rather than model issues.I am now inclined to make the application service throw on technical errors during
Load
andStore
, but keep returning theErrorResult
when an exception is thrown when handling the command itself.The text was updated successfully, but these errors were encountered: