Skip to content

Error Handling

Andrew Bullock edited this page Oct 30, 2017 · 1 revision

Error Handling

In the registry of each application there's a line like this:

container.Register<IDefaultErrorHandler, ErrorHandler>(Lifecycle.HttpContextOrThreadLocal);

IDefaultErrorHandler defines the handler within the application which is capable of handling common error conditions.

When faced with an error condition in a Handler or other pre-handler-execution pipelineoperator, you normally want to return an appropriate ErrorResult. Throwing an exception is an anti-pattern.

return ErrorResult.NotFound();

This will trigger the NotFound method in the default error handler to be executed

TODO

Clone this wiki locally