Anyhow i try when I throw exception in controller layer, this catch line does not fire.
Connecterd link Global exception handling in OWIN middleware
public class GlobalExceptionMiddleware : OwinMiddleware
{
public GlobalExceptionMiddleware(OwinMiddleware next) : base(next)
{ }
public override async Task Invoke(IOwinContext context)
{
try
{
await Next.Invoke(context);
}
catch (Exception ex)
{
}
}
}
I throw exception in this way:
public class MyController
{
public async Task<MyRestModel> Get(int id)
{
throw new Exception();
What I am doing wrong?