public override void OnActionExecuted(HttpActionExecutedContext context) { base.OnActionExecuted(context); // Don't bother processing bad StatusCodes if there is an exception attached - it will be handled by another part of the framework. if (context != null && context.Exception == null && context.Response != null && (int)context.Response.StatusCode >= 400) { try { throw new RaygunWebApiHttpException( context.Response.StatusCode, context.Response.ReasonPhrase, string.Format("HTTP {0} returned while handling Request {2} {1}", (int)context.Response.StatusCode, context.Request.RequestUri, context.Request.Method)); } catch (RaygunWebApiHttpException e) { _clientCreator.GenerateRaygunWebApiClient().CurrentHttpRequest(context.Request).SendInBackground(e, null, new Dictionary <string, string> { { "ReasonCode", e.ReasonPhrase } }); } catch (Exception e) { // This is here on the off chance that interacting with the context or HTTP Response throws an exception. _clientCreator.GenerateRaygunWebApiClient().CurrentHttpRequest(context.Request).SendInBackground(e); } } }
public IHttpController Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType) { try { return(_concreteActivator.Create(request, controllerDescriptor, controllerType)); } catch (InvalidOperationException ex) { var client = _clientCreator.GenerateRaygunWebApiClient(); client.CurrentHttpRequest(request).SendInBackground(ex.InnerException); client.FlagAsSent(ex); // Stops us re-sending the outer exception throw; } catch (Exception ex) { _clientCreator.GenerateRaygunWebApiClient().CurrentHttpRequest(request).SendInBackground(ex); throw; } }
public IHttpController Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType) { try { return(_concreteActivator.Create(request, controllerDescriptor, controllerType)); } catch (Exception ex) { _clientCreator.GenerateRaygunWebApiClient().CurrentHttpRequest(request).Send(ex); throw; } }
public HttpControllerDescriptor SelectController(HttpRequestMessage request) { try { return(_concreteSelector.SelectController(request)); } catch (HttpResponseException ex) { _clientCreator.GenerateRaygunWebApiClient().CurrentHttpRequest(request).SendInBackground(ex); throw; } }
public HttpActionDescriptor SelectAction(HttpControllerContext controllerContext) { try { return(_concreteSelector.SelectAction(controllerContext)); } catch (HttpResponseException ex) { _clientCreator.GenerateRaygunWebApiClient(controllerContext.Request).SendInBackground(ex); throw; } }
public override void OnActionExecuted(HttpActionExecutedContext context) { base.OnActionExecuted(context); // Don't bother processing bad StatusCodes if there is an exception attached - it will be handled by another part of the framework. if (context != null && context.Exception == null && context.Response != null && (int)context.Response.StatusCode >= 400) { Exception e = new RaygunWebApiHttpException( string.Format("HTTP {0} returned while handling Request {2} {1}", (int)context.Response.StatusCode, context.Request.RequestUri, context.Request.Method), context.Response); _clientCreator.GenerateRaygunWebApiClient(context.Request).SendInBackground(e); } }
public HttpControllerDescriptor SelectController(HttpRequestMessage request) { try { return(_concreteSelector.SelectController(request)); } catch (HttpResponseException ex) { _clientCreator.GenerateRaygunWebApiClient(request).SendInBackground(ex, new List <string> { RaygunWebApiClient.UnhandledExceptionTag }); throw; } }
public override void OnActionExecuted(HttpActionExecutedContext context) { base.OnActionExecuted(context); // Don't bother processing bad StatusCodes if there is an exception attached - it will be handled by another part of the framework. if (context != null && context.Exception == null && context.Response != null && (int)context.Response.StatusCode >= 400) { var e = new RaygunWebApiHttpException( $"HTTP {(int)context.Response.StatusCode} returned while handling Request {context.Request.Method} {context.Request.RequestUri}", context.Response); _clientCreator.GenerateRaygunWebApiClient(context.Request).SendInBackground(e, new List <string> { RaygunWebApiClient.UnhandledExceptionTag }); } }
public override void OnActionExecuted(HttpActionExecutedContext context) { base.OnActionExecuted(context); if (context != null && context.Response != null && (int)context.Response.StatusCode >= 400) { try { throw new RaygunWebApiHttpException( context.Response.StatusCode, string.Format("HTTP {0} returned while handling URL {1}", (int)context.Response.StatusCode, context.Request.RequestUri)); } catch (Exception e) { _clientCreator.GenerateRaygunWebApiClient().Send(e); } } }
public override void OnException(HttpActionExecutedContext context) { _clientCreator.GenerateRaygunWebApiClient().CurrentHttpRequest(context.Request).SendInBackground(context.Exception); }
public override void Log(ExceptionLoggerContext context) { _clientCreator.GenerateRaygunWebApiClient(context.Request).SendInBackground(context.Exception); }
public override void Log(ExceptionLoggerContext context) { _clientCreator.GenerateRaygunWebApiClient().CurrentHttpRequest(context.Request).Send(context.Exception, new List <string> { "Exception Logger" }); }
public override void OnException(HttpActionExecutedContext context) { _clientCreator.GenerateRaygunWebApiClient(context.Request).SendInBackground(context.Exception, new List <string> { RaygunWebApiClient.UnhandledExceptionTag }); }