Esempio n. 1
0
 /// <summary>
 /// Creates and Logs the error context information for the occurred error
 /// </summary>
 /// <param name="error">Error code</param>
 /// <param name="method">Method where the error occurred</param>
 /// <param name="additionalInfo">Additional information for the error</param>
 /// <param name="exception">Inner Exception</param>
 /// <param name="descriptionParameters">Description Parameters</param>
 /// <param name="additionalDescriptionParameters">Additional Description Parameters</param>
 /// <param name="shortName">Shortname of the business error occured for</param>
 /// <param name="arguments">Arguments to log of the method where the error occurred</param>
 /// <returns>Error context information</returns>
 public static ErrorContextInformation CreateAndLogError(Errors error, string method, string additionalInfo = null, Exception exception = null, 
     object[] descriptionParameters = null, object[] additionalDescriptionParameters = null, string shortName = "", params object[] arguments)
 {
     return new ErrorContextInformation(error.ToString(), error.GetDescription(descriptionParameters), method,
                                        additionalInformation: string.IsNullOrEmpty(additionalInfo)
                                                                   ? error.GetAdditionalDescription(additionalDescriptionParameters)
                                                                   : (additionalDescriptionParameters == null
                                                                          ? additionalInfo
                                                                          : string.Format(additionalInfo, additionalDescriptionParameters)),
                                        innerException: exception, shortName: shortName, arguments: arguments);
 }