Skip to content
This repository has been archived by the owner on Aug 1, 2022. It is now read-only.

Commit

Permalink
feat(Exception): GlobalExceptionFilter supports custom Handler (#84)
Browse files Browse the repository at this point in the history
* doc: Modify the document

* chore: GlobalExceptionFilter supports custom Handler
  • Loading branch information
zhenlei520 authored Jul 11, 2022
1 parent 11ebf36 commit fb11a69
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Masa.Utils.Exceptions/Handlers/GlobalExceptionFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ public MvcGlobalExcetionFilter(IServiceProvider serviceProvider,
public void OnException(ExceptionContext context)
{
var masaExceptionContext = new MasaExceptionContext(context.Exception, context.HttpContext);
_options.ExceptionHandler?.Invoke(masaExceptionContext);
if (_options.ExceptionHandler != null)
{
_options.ExceptionHandler.Invoke(masaExceptionContext);
}
else
{
_masaExceptionHandler?.OnException(masaExceptionContext);
}

if (masaExceptionContext.HttpContext.Response.HasStarted)
return;
Expand Down

0 comments on commit fb11a69

Please sign in to comment.