Content Application Developer Manual / Version 2207
Table Of ContentsIn any application, error handling is an important part of a consistent user experience. In a web application the goal is to return a useful response to the client in the case of an error condition, including an appropriate HTTP status code, an informative error page, a redirection, and often a combination of these.
Although the details of how particular errors are dealt with may differ from case to case, this section gives an overview of the different application components involved and best practices on how to implement error handling strategies.
Errors during request processing usually arise in one of two forms: expected and unexpected errors.
Expected errors are often the outcome of validating input sent with the request such as the URL path, parameters or cookies. Request input is typically interpreted by a controller to construct a model and determine the view, so this is where such errors should be handled.
Unexpected errors can - by definition - occur at any time during request processing. In addition to explicit error handling in controllers, it is therefore necessary to implement uncaught exception handling in an application.