Skip to content

Custom error handling #318

Closed Answered by Kaliumhexacyanoferrat
Matasx asked this question in Q&A

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

You must be logged in to vote
1 reply
@Matasx

Matasx Oct 6, 2022
Collaborator Author

Answer selected by Matasx

Matasx
Oct 7, 2022
Collaborator Author

You must be logged in to vote
4 replies
@Matasx

Matasx Oct 7, 2022
Collaborator Author

@Kaliumhexacyanoferrat

@Matasx

Matasx Oct 13, 2022
Collaborator Author

@Kaliumhexacyanoferrat

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