internal void AddExceptionData(Exception ex) { if (ex == null) { return; } try { var servicePoint = ServicePointManager.FindServicePoint(Message.RequestUri); ex .AddLoggedData("ServicePoint.ConnectionLimit", servicePoint.ConnectionLimit) .AddLoggedData("ServicePoint.CurrentConnections", servicePoint.CurrentConnections) .AddLoggedData("ServicePointManager.CurrentConnections", ServicePointManager.DefaultConnectionLimit); } catch { // ignored } ex .AddLoggedData("Caller.Name", _callerName) .AddLoggedData("Caller.File", _callerFile) .AddLoggedData("Caller_Line", _callerLine.ToString()); }
public static HttpCallResponse <T> Create <T>(HttpResponseMessage response, Exception error) { error .AddLoggedData("Response.Code", ((int)response.StatusCode).ToString()) .AddLoggedData("Response.Status", response.StatusCode.ToString()) .AddLoggedData("Response.ReasonPhrase", response.ReasonPhrase) .AddLoggedData("Response.ContentType", response.Content.Headers.ContentType) .AddLoggedData("Request.URI", response.RequestMessage.RequestUri); return(new HttpCallResponse <T>(response, error)); }
/// <summary> /// Manually write an exception to our standard exception log. /// </summary> /// <param name="exception">The <see cref="Exception"/> to log.</param> /// <param name="key">(Optional) The throttle cache key.</param> public static void LogException(Exception exception, string key = null) { if (!ShouldLog(key)) { return; } if (exception is DeserializationException deserializationException) { exception.AddLoggedData("Snippet-After", deserializationException.SnippetAfterError) .AddLoggedData("Position", deserializationException.Position.ToString()) .AddLoggedData("Ended-Unexpectedly", deserializationException.EndedUnexpectedly.ToString()); } ErrorStore.LogExceptionWithoutContext(exception, appendFullStackTrace: true); RecordLogged(key); }
/// <summary> /// Manually write an exception to our standard exception log. /// </summary> /// <param name="exception">The <see cref="Exception"/> to log.</param> /// <param name="key">(Optional) The throttle cache key.</param> public static void LogException(Exception exception, string key = null) { if (!ShouldLog(key)) { return; } if (exception is DeserializationException deserializationException) { exception.AddLoggedData("Snippet-After", deserializationException.SnippetAfterError) .AddLoggedData("Position", deserializationException.Position.ToString()) .AddLoggedData("Ended-Unexpectedly", deserializationException.EndedUnexpectedly.ToString()); } exception.LogNoContext(); RecordLogged(key); }