private void SetEnviromentInfo(ExceptionReport report) { report.cul = Thread.CurrentThread.CurrentCulture.Name; if (string.IsNullOrEmpty(report.cul)) report.cul = "en"; try { report.os = Environment.OSVersion.VersionString; } catch (Exception) { if (Configuration.ThrowExceptions) throw; } if (Configuration.IncludeMachineName) { try { report.hn = Environment.MachineName; } catch (Exception) { if (Configuration.ThrowExceptions) throw; } } }
/// <summary> /// Submit an exception to exceptron Servers. /// </summary> /// <param name="exceptionData">Exception data to be reported to the server</param> public ExceptionResponse SubmitException(ExceptionData exceptionData) { try { ValidateState(exceptionData); var report = new ExceptionReport(); report.ap = Configuration.ApiKey; report.dn = ClientName; report.dv = ClientVersion; report.aver = _applicationVersion; report.ext = exceptionData.Exception.GetType().FullName; report.stk = ConvertToFrames(exceptionData.Exception); report.exm = exceptionData.Exception.Message; report.cmp = exceptionData.Component; report.uid = exceptionData.UserId; report.msg = exceptionData.Message; report.sv = (int)exceptionData.Severity; report.fv = _maxFrameworkVersion; report.ft = FrameworkType; SetEnviromentInfo(report); var exceptionResponse = RestClient.Put<ExceptionResponse>(Configuration.Host, report); exceptionData.Exception.Data["et"] = exceptionResponse.RefId; return exceptionResponse; } catch (Exception e) { Trace.WriteLine("Unable to submit exception to exceptron. ", e.ToString()); if (Configuration.ThrowExceptions) { //throw; } return new ExceptionResponse { Exception = e }; } }