Skip to content
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

How does Exception Handling integrate into Clean Architecture? #23

Open
tscz opened this issue Feb 20, 2021 · 0 comments
Open

How does Exception Handling integrate into Clean Architecture? #23

tscz opened this issue Feb 20, 2021 · 0 comments

Comments

@tscz
Copy link

tscz commented Feb 20, 2021

Hi @thombergs, thanks for a great book, it was really a great eye-opener to bring clean architecture into practice.

In general, I have problems to connect the dots in one topic: How does exception handling conceptionally fit into the picture?

For example the LoadAccountPort defines loadAccount interface/communication channel but the concrete adapter implementation throws an EntityNotFoundException if an account is not found. Instead of an implementation detail isn't this a property of the communication port, which all adapters of this port should comply with? Or asked the other way round, how can I force/lead implementeers of port interfaces to throw "expected" exceptions?

Another area where I am not sure about is global error handling: Say I want that the EntityNotFoundException should relate to a 404 and the service ThresholdExceededException should lead to a 403, both with a default error response body (i.e based on rfc7807). If I create now a global error handler in the web adapter, isn't then also the web adapter implementation depending on implementation details (EntityNotFoundException) of the implementation detail of another out adapter impl.?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant