/// <summary> /// Adds and exception intercept handler. /// </summary> /// <param name="exceptionInterceptHandler">The exception intercept handler.</param> public void AddExceptionInterceptHandler(IExceptionInterceptHandler exceptionInterceptHandler) { _exceptionInterceptHandlers.Add(exceptionInterceptHandler); }
/// <summary> /// Adds an exception intercept handler. /// </summary> /// <param name="builder">The builder.</param> /// <param name="exceptionInterceptHandler">The exception handler.</param> /// <returns></returns> public static IApplicationBuilder AddExceptionInterceptHandler(this IApplicationBuilder builder, IExceptionInterceptHandler exceptionInterceptHandler) { var exceptionInterceptManager = builder.ApplicationServices.GetService <ExceptionInterceptManager>(); if (exceptionInterceptManager != null) { exceptionInterceptManager.AddExceptionInterceptHandler(exceptionInterceptHandler); } return(builder); }