You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Define what you mean by “loading a page”. Are you using Razor Pages or MVC? I’ve looked at the PageService and there shouldn’t be any try/catches on service level for initialization errors.
I'm using Razor pages. If you take the Piranha Razor pages template app and add that custom block to a page, then when you navigate to the page containing the block (not in the manager) that's when it returns an error that appears to bypass any exception/error handling middleware.
The way I'm handling this is to catch all exceptions from custom block constructors, this is a decent approach as it's then possible to display the error message in the display of the block itself rather than crashing the services, but for those exceptions that are missed for whatever reason it would be much better if the standard processing functioned normally.
If a custom block throws an exception on initialization, the exception appears to completely bypass any middleware exception handling.
E.g. given this custom block
Add this block to a page and then loading the page.
In Development mode the developer exception page is not displayed.
In Production mode
UseExceptionHandler("/Error")
does not take effect.In both cases a plain 500 status code is returned resulting in the browser default error page, which is not what we want.
Does anyone know why this should be happening or what we should do to reinstate the behaviour of the exception handling middleware?
The text was updated successfully, but these errors were encountered: