liveBook · Manning

Exception

As explained in Spring Start Here, Second Edition

An exception signals an abnormal condition that can be thrown during execution and handled by a caller or interceptor.

An exception signals an abnormal condition during execution. In a REST endpoint, you can handle it in the controller action or separate its handling from that action. section 10.6

Choose where to handle an exception:

  • Handle it in the controller action when the handling belongs there; this couples the logic to that action and can lead to duplication. section 10.6
  • Use a REST controller advice class to separate exception handling from the action. section 10.6

How Spring Start Here, Second Edition covers it

How deep it goes
Compares action-level handling with controller advice and notes coupling and duplication, without detailing implementation.
What you can do after
Apply exception handling in a controller action or separate it with a REST controller advice class.
How it connects
Connects exceptions with REST endpoints, controller actions, and REST controller advice.

Also explained in

Compare how 29 books explain exception →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring Start Here, Second Edition. The section links point to the parts of the book it draws on.