Пример #1
0
 public BaseException(ExceptionErrorCode code) : base()
 {
     this.AppendCorrelationId();
     Code = code;
 }
Пример #2
0
 public BaseException(ExceptionErrorCode code, string message, Exception innerException) : base(message, innerException)
 {
     this.AppendCorrelationId();
     Code = code;
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebExceptionBase"/> class.
 /// </summary>
 /// <param name="errorCode">The error code.</param>
 /// <param name="innerException">The inner exception.</param>
 /// <param name="info">The info.</param>
 protected WebExceptionBase(ExceptionErrorCode errorCode, System.Exception innerException, params string[] info)
     : base(GetMessageFromResource(errorCode, info), innerException)
 {
     _errorCode = errorCode;
 }
Пример #4
0
        /// <summary>
        /// Get the resource string from invoked assembly by the key.
        /// </summary>
        /// <param name="errorCode">Errorcode for the exception</param>
        /// <param name="info">String parameters for error message.</param>
        /// <returns>Error message.</returns>
        private static string GetMessageFromResource(ExceptionErrorCode errorCode, params string[] info)
        {
            System.Resources.ResourceManager rm = new global::System.Resources.ResourceManager("Resources.ErrorMessages",
                                                                                               global::System.Reflection.
                                                                                                Assembly.Load(
                                                                                                "App_GlobalResources"));
            //Try to get specific error message from Resource.
            string errorMessage = rm.GetString(errorCode.ToString());

            if (string.IsNullOrEmpty(errorMessage))
            {
                try
                {
                    errorMessage = string.Format(rm.GetString(ExceptionErrorCode.ErrorMessageNotFound.ToString()), ((int)errorCode).ToString());
                }
                catch
                {
                    errorMessage = string.Format("Failed to get the ErrorMessage for ErrorCode: {0} and {1}",
                                                 ((int)errorCode).ToString(), ((int)ExceptionErrorCode.ErrorMessageNotFound).ToString());
                }
            }
            else
            {
                if (info != null && info.Length != 0)
                {//Whether we should use the format method to combine string.
                    errorMessage = string.Format(errorMessage, info);
                }
            }

            return errorMessage;
        }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebExceptionBase"/> class.
 /// </summary>
 /// <param name="errorCode">The error code.</param>
 /// <param name="innerException">The inner exception.</param>
 /// <param name="doNotGetMsgFromResource">No matter false or true set to this parameter, we would't get the message from Resource.</param>
 protected WebExceptionBase(ExceptionErrorCode errorCode, System.Exception innerException, bool doNotGetMsgFromResource)
     : base("", innerException)
 {
     _errorCode = errorCode;
 }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebExceptionBase"/> class.
 /// </summary>
 /// <param name="errorCode">The error code.</param>
 /// <param name="info">The info.</param>
 protected WebExceptionBase(ExceptionErrorCode errorCode, params string[] info)
     : base(GetMessageFromResource(errorCode, info))
 {
     _errorCode = errorCode;
 }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebExceptionBase"/> class.
 /// </summary>
 /// <param name="errorCode">The error code.</param>
 /// <param name="doNotGetMsgFromResource">No matter false or true set to this parameter, we would't get the message from Resource.</param>
 protected WebExceptionBase(ExceptionErrorCode errorCode, bool doNotGetMsgFromResource)
 {
     _errorCode = errorCode;
 }
Пример #8
0
 /// <summary>
 /// Initializes a new instance of the BusinessExceptionBase class
 /// </summary>
 /// <param name="errorCode">Exception error code</param>
 /// <param name="message">Exception message</param>
 /// <param name="innerException">Inner exception</param>
 protected BusinessExceptionBase(ExceptionErrorCode errorCode, string message, System.Exception innerException)
     : base(message, innerException)
 {
     _errorCode = errorCode;
 }
Пример #9
0
 /// <summary>
 /// Initializes a new instance of the BusinessExceptionBase class
 /// </summary>
 /// <param name="errorCode">Exception error code</param>
 /// <param name="message">Exception message</param>
 protected BusinessExceptionBase(ExceptionErrorCode errorCode, string message)
     : base(message)
 {
     _errorCode = errorCode;
 }
Пример #10
0
 /// <summary>
 /// Initializes a new instance of the BusinessException class.
 /// </summary>
 /// <param name="errorCode">The error code.</param>
 public IntegrationException(ExceptionErrorCode errorCode, string errorMessage)
     : base(errorCode, true)
 {
     _errorMessage = errorMessage;
     //// Constructor for Unknown exception
 }
Пример #11
0
 /// <summary>
 /// Initializes a new instance of the CommunicationException class.
 /// </summary>
 /// <param name="errorCode">The error code.</param>
 /// <param name="innerException">The original Exception</param>
 public ServiceCommunicationException(ExceptionErrorCode errorCode, Exception innerException)
     : base(errorCode, innerException, true)
 {
     //// Constructor for Unknown exception
 }