/// <summary> /// Submits the error report. /// </summary> /// <param name="data">The error data.</param> public void SubmitError(Error data) { Log.FormattedInfo(typeof(ExceptionlessClient), "Submitting error: id={0} type={1}", data != null ? data.Id : "null", data != null ? data.Type : "null"); if (CheckForDuplicateError(data)) { return; } if (!Configuration.Enabled) { Log.Info(typeof(ExceptionlessClient), "Configuration is disabled. The error will not be submitted."); return; } if (data == null) { throw new ArgumentNullException("data"); } if (data.ExceptionlessClientInfo == null) { data.ExceptionlessClientInfo = ExceptionlessClientInfoCollector.Collect(this, Configuration.IncludePrivateInformation); } if (String.IsNullOrEmpty(data.Id)) { data.Id = ObjectId.GenerateNewId().ToString(); } _queue.Enqueue(data); Log.FormattedInfo(typeof(ExceptionlessClient), "Setting last error id '{0}'", data.Id); LastErrorIdManager.SetLast(data.Id); QuickTimer(); SaveEmailAddress(data.UserEmail, false); LocalConfiguration.SubmitCount++; // TODO: This can be removed once we fix the bug in the ObservableConcurrentDictionary where IsDirty is not set immediately. LocalConfiguration.IsDirty = true; LocalConfiguration.Save(); }
internal static Error ToError(ExceptionlessClient client, Exception exception, string submissionMethod = "Manual", IDictionary <string, object> contextData = null) { Error error = exception.ToErrorModel(); error.Id = ObjectId.GenerateNewId().ToString(); error.OccurrenceDate = DateTimeOffset.Now; error.ExceptionlessClientInfo = ExceptionlessClientInfoCollector.Collect(client, client.Configuration.IncludePrivateInformation); error.ExceptionlessClientInfo.SubmissionMethod = submissionMethod; foreach (IExceptionlessPlugin plugin in client.Plugins) { try { var ctx = new ExceptionlessPluginContext(client, contextData); plugin.AfterCreated(ctx, error, exception); } catch (Exception ex) { client.Log.FormattedError(typeof(ErrorExtensions), ex, "Error creating error model information: {0}", ex.Message); } } return(error); }