protected virtual IEnumerable<AirbrakeVar> BrowserData(IExceptionInformation exInfo, IEnvironmentInformation envInfo) { if (HttpRequest.Browser == null) return Enumerable.Empty<AirbrakeVar>(); return new[] { new AirbrakeVar("Browser.Browser", HttpRequest.Browser.Browser), new AirbrakeVar("Browser.ClrVersion", HttpRequest.Browser.ClrVersion), new AirbrakeVar("Browser.Cookies", HttpRequest.Browser.Cookies), new AirbrakeVar("Browser.Crawler", HttpRequest.Browser.Crawler), new AirbrakeVar("Browser.EcmaScriptVersion", HttpRequest.Browser.EcmaScriptVersion), new AirbrakeVar("Browser.JavaApplets", HttpRequest.Browser.JavaApplets), new AirbrakeVar("Browser.MajorVersion", HttpRequest.Browser.MajorVersion), new AirbrakeVar("Browser.MinorVersion", HttpRequest.Browser.MinorVersion), new AirbrakeVar("Browser.Platform", HttpRequest.Browser.Platform), new AirbrakeVar("Browser.W3CDomVersion", HttpRequest.Browser.W3CDomVersion) }; }
protected virtual string Url(IExceptionInformation exInfo, IEnvironmentInformation envInfo) { return exInfo.CatchingFile; }
protected virtual IEnumerable<AirbrakeVar> Session(IExceptionInformation exInfo, IEnvironmentInformation envInfo) { return Enumerable.Empty<AirbrakeVar>(); }
protected virtual AirbrakeRequest Request(IExceptionInformation exInfo, IEnvironmentInformation envInfo) { return new AirbrakeRequest(envInfo.Uri, exInfo.CatchingFile, exInfo.CatchingMethod.Name) { Url = Url(exInfo, envInfo), CgiData = CgiData(exInfo, envInfo).ToArray(), Params = Params(exInfo, envInfo).ToArray(), Session = Session(exInfo, envInfo).ToArray() }; }
/// <summary> /// Creates a <see cref="AirbrakeError"/> from the the specified exception. /// </summary> /// <param name="exInfo"></param> /// <param name="envInfo"></param> /// <returns> /// A <see cref="AirbrakeError"/>, created from the the specified exception. /// </returns> protected AirbrakeError Error(IExceptionInformation exInfo, IEnvironmentInformation envInfo) { var error = Activator.CreateInstance<AirbrakeError>(); error.CatchingMethod = exInfo.CatchingMethod; error.Class = exInfo.ExceptionClass.FullName; error.Message = exInfo.Message; error.Backtrace = exInfo.TraceLines.ToArray(); return error; }
protected override IEnumerable<AirbrakeVar> CgiData(IExceptionInformation exInfo, IEnvironmentInformation envInfo) { return EnvironmentData(exInfo, envInfo). Concat(HeadersData(exInfo, envInfo)). Concat(CookiesData(exInfo, envInfo)). Concat(BrowserData(exInfo, envInfo)); }
protected override string Url(IExceptionInformation exInfo, IEnvironmentInformation envInfo) { return HttpRequest.Url.ToString(); }
protected override IEnumerable<AirbrakeVar> Session(IExceptionInformation exInfo, IEnvironmentInformation envInfo) { return BuildVars(HttpContext.Session); }
protected override IEnumerable<AirbrakeVar> Params(IExceptionInformation exInfo, IEnvironmentInformation envInfo) { return BuildVars(HttpRequest.Params); }
protected virtual IEnumerable<AirbrakeVar> HeadersData(IExceptionInformation exInfo, IEnvironmentInformation envInfo) { return BuildVars(HttpRequest.Headers); }
protected virtual IEnumerable<AirbrakeVar> EnvironmentData(IExceptionInformation exInfo, IEnvironmentInformation envInfo) { return new[] { new AirbrakeVar("Environment.MachineName", Environment.MachineName), new AirbrakeVar("Environment.OSversion", Environment.OSVersion), new AirbrakeVar("Environment.Version", Environment.Version) }; }