proudmonkey/AutoWrapper

Custom scheme for runtime called exceptions

Dubzer opened this issue · 1 comments

Hi. I created my own API response schema and I also would like to create schema for exceptions. According to the readme, I can create model and then pass it to the ApiException constructor. But it wouldn't work, for example, with unhandled exceptions that were thrown while controller was executing:

    [HttpGet]
    public ApiResponse AnUnavoidableMistake()
    {
        int.Parse("This will cause an exception");
        
        return new ApiResponse("It's a miracle we survived!");
    }

This code will return ApiException JSON.
So is it possible to replace it with my own error schema?

Hello Dubzer - At the moment, AutoWrapper doesn't support this. All unhandled exceptions will be defaulted to either ApiException or ApiProblemDetailException.