HST error pages and error handling
The HST provides many ways for nice dynamic, customizable, error pages and error handling. As this topic is pretty large, and can be addressed in multiple ways, we split the solution into several separate pages. The first solutions are the easiest, but at the same time the most limited. Furthermore, some of the pages are complementary solutions, to get the perfect error handling you want. The last solution might be for some developers one bridge to far, but for the more advanced developers, who want to have fine grained control over how to handle exceptions, this is the way to do it.
Correct error handling is of major importance. Setting the correct response headers is very important for for example search engines. You do not want a 200 response for a 404 page, as this gets indexed by crawlers as if it is correct page. You might end up having your error page very high rated in search engines.
Note that the HST2 cannot provide a dynamic (for example with a repository based menu) error page when the HST2 cannot be started at all, for example because of broken Spring configuration, or a repository connection that cannot be established. In this corner case, a
is send as response, which boils down to a 503.
Error pages and error handling
- Handling error codes and exceptions by the web.xml
- Add a catch-all sitemap item that creates a dynamic 404 page
- Simple exception handling
- Advanced exception handling