Skip to content
This repository was archived by the owner on Oct 2, 2024. It is now read-only.

Commit 3615db6

Browse files
committed
No longer rely on HttpContext.AddError to forward Web API exceptions to SerilogWeb module
Instead rely on ad-hoc extension method that stores it temporarily in HttpContext Related to #16 and #3
1 parent 8de367c commit 3615db6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
using System.Web;
22
using System.Web.Http.ExceptionHandling;
3+
using SerilogWeb.Classic.Extensions;
34

45
namespace SerilogWeb.Classic.WebApi
56
{
67
public class WebApiExceptionLogger : ExceptionLogger
78
{
89
public override void Log(ExceptionLoggerContext context)
910
{
10-
HttpContext.Current.AddError(context.Exception);
11+
if (context.Exception != null)
12+
{
13+
HttpContext.Current.AddSerilogWebError(context.Exception);
14+
}
1115
}
1216
}
1317
}

0 commit comments

Comments
 (0)