/// <summary>Creates a new instance of <see cref="Error" />.</summary> /// <param name="ex">An <see cref="Exception" /> to initialize the <see cref="Error" /> with.</param> /// <param name="isCritical">Mark this error occurrence as a critical error.</param> /// <param name="addDefaultInformation"> /// Whether to add the default information like request info and machine info to the /// case or not. /// </param> /// <param name="extendedData"> /// As list of objects to add to the error's ExtendedData collection. If the object is an /// <see cref="ExtendedDataInfo">ExtendedDataInfo</see>, the settings from that will be used to add the ExtendedData. /// </param> /// <param name="tags">A list of tags to add to the error.</param> /// <param name="submissionMethod">The method that was used to collect the error.</param> /// <param name="contextData">Any additional contextual data that should be used during creation of the error information.</param> /// <returns>A new instance of <see cref="Error" />.</returns> public Error CreateError(Exception ex, bool isCritical = false, bool addDefaultInformation = true, IEnumerable <object> extendedData = null, IEnumerable <string> tags = null, string submissionMethod = "Manual", IDictionary <string, object> contextData = null) { Error error = ToError(this, ex, submissionMethod, contextData); if (extendedData != null) { foreach (object o in extendedData) { error.AddObject(o); } } if (tags != null) { error.Tags.AddRange(tags); } if (isCritical) { error.MarkAsCritical(); } if (addDefaultInformation) { error.AddDefaultInformation(contextData); } return(error); }