Skip to content

Instantly share code, notes, and snippets.

@jebarsoba
Created April 19, 2018 19:51
Show Gist options
  • Save jebarsoba/e35aac734c672d28ffae6cdb029187f3 to your computer and use it in GitHub Desktop.
Save jebarsoba/e35aac734c672d28ffae6cdb029187f3 to your computer and use it in GitHub Desktop.
public async Task Invoke(HttpContext context)
{
try
{
await this.next(context);
}
catch (Exception ex)
{
await HandleExceptionAsync(context, ex);
}
}
private async Task HandleExceptionAsync(HttpContext context, Exception exception)
{
// Populate ExceptionLogEntry...
// Write a new error entry in the logs...
// Return a clean HTTP 500 response to the client...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment