123456789101112131415161718 |
- using System;
- using System.Net.Http;
- using System.Web.Http.Filters;
- using iiie.Logs.DataAccess;
- using iiie.Logs.DBO;
-
- namespace iiie.WebApiUtils.BusinessManager.Attributes
- {
- [AttributeUsage(AttributeTargets.Method)]
- public class ExceptionLoggerAttribute : ExceptionFilterAttribute
- {
- public override void OnException(HttpActionExecutedContext context)
- {
- var result = Logger.Error<int>(ResultStatus.InternalError, context.Exception);
- context.Response = context.Request.CreateErrorResponse(BMRHandler<int>.ResultStatusToHttp(result.Status), BMRHandler<int>.OpResultToString(result));
- }
- }
- }
|