servicestackservicestack-razor

Is there a YSOD in ServiceStack for Unhandled Exceptions?


Is there a built-in renderer for unhandled exceptions when using the RazorFormat plugin?

Our service is throwing an exception, but ServiceStack is rendering the corresponding Razor view anyway (just with empty data). I would have expected Razor to pick up the error in the ResponseStatus property and display something like ASP.Net's YSOD.

Edit: Our DebugMode on HostConfig is set to 'true'.


Solution

  • See this previous answer on getting Error Info from a Razor Page, e.g. You can short-cut your page to just display the Error message with:

    @if (RenderErrorIfAny()) { return; }
    

    You can also specify a custom fallback Razor Page for different Errors.