I really like this!
David Griver
11

Thank you David Griver!

You are right. Since we are using exceptions to throw any error that has occurred either on the controller or any of the services involved, we can catch them at any point:

  • At the service, if the exception occurred there
  • At the controller if the exception occurred in the controller or service.
  • At the router if it occurred even when processing the initial promise.

So, in order to avoid noisy boilerplate, if you aren’t willing to treat a specific exception(s) in a different way, our best option is to leave exception handling to the router handleController , which will respond it to the user in an appropriate way.