Skip to content

Custom error handling #318

Discussion options

You must be logged in to vote

The ErrorHandlingProvider on root level will look for an IErrorHandler instance in the routing chain to actually render an error to HTML. This allows, for example, the WebsiteRouter to render error messages in the style of the chosen theme. Nevertheless, this approach can only be used to render HTML error pages because the result of the renderer is embedded into the current template.

To respond with JSON, you would currently need to clone the ErrorHandlingProvider and add it as a concern to your webservice router. Something like:

    public sealed class JsonErrorHandler : IConcern
    {

        #region Get-/Setters

        public IHandler Content { get; }

        public IHandler Parent…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@Matasx
Comment options

Answer selected by Matasx
Comment options

You must be logged in to vote
4 replies
@Matasx
Comment options

@Kaliumhexacyanoferrat
Comment options

@Matasx
Comment options

@Kaliumhexacyanoferrat
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants