6.17.1 Status Handlers

The @Error annotation supports defining either an exception class or an HTTP status. Methods annotated with @Error must be defined with in a class annotated with @Controller. The annotation also supports the notion of global and local, local being the default.

Local error handlers only respond to exceptions thrown as a result of the route being matched to another method in the same controller. Global error handlers can be invoked as a result of any thrown exception. A local error handler is always searched for first when resolving which handler to execute.

When defining an error handler for an exception, you can specify the exception instance as an argument to the method and omit the exception property of the annotation.