[Archived] Diagnostics middleware for reporting info and handling exceptions and errors in ASP.NET Core, and diagnosing Entity Framework Core migrations errors. Project moved to https://github.com/aspnet/AspNetCore
I would like to propose a new feature for this libary, UseDeveloperExceptionJson(). A middelware that is doeing the same thing as UseDevelopeExceptionPage() but returns Json.
I think the extension needs a routing filter so the middleware can deside what to return. this would be handy when creating an SPA where the api calls would return json. Now I got html in the F12 tools when I have an exception during development. I know that Unit Testing must solve most of the exception, but what if you forget the register a dependency. Finding the reason in the F12 tools when the return body is html is not so handy. As for now I have my own middleware that is doing something like that, but it can be handy as it was in the same namespace and assembly.
the Configure method can do something like:
if (env.IsDevelopment()) { app.UseDeveloperExceptionJson("*/api/*"); app.UseDeveloperExceptionPage(); }
I would like to propose a new feature for this libary, UseDeveloperExceptionJson(). A middelware that is doeing the same thing as UseDevelopeExceptionPage() but returns Json.
I think the extension needs a routing filter so the middleware can deside what to return. this would be handy when creating an SPA where the api calls would return json. Now I got html in the F12 tools when I have an exception during development. I know that Unit Testing must solve most of the exception, but what if you forget the register a dependency. Finding the reason in the F12 tools when the return body is html is not so handy. As for now I have my own middleware that is doing something like that, but it can be handy as it was in the same namespace and assembly.
the Configure method can do something like:
if (env.IsDevelopment()) { app.UseDeveloperExceptionJson("*/api/*"); app.UseDeveloperExceptionPage(); }