C# (CSharp) Класс System. Exception Code Examples

C# (CSharp) System.Exception - 30 примеров найдено. Это лучшие примеры C# (CSharp) кода для класса System.Exception, полученные из open source проектов. Вы можете ставить оценку каждому примеру, чтобы помочь нам улучшить качество примеров.
        public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
        {
            ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context);

            if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterValue"))
            {
                return new InvalidParameterValueException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
            }

            if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterCombination"))
            {
                return new InvalidParameterCombinationException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
            }

            if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidCacheParameterGroupState"))
            {
                return new InvalidCacheParameterGroupStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
            }

            if (errorResponse.Code != null && errorResponse.Code.Equals("CacheParameterGroupNotFound"))
            {
                return new CacheParameterGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
            }

            return new AmazonElastiCacheException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
        }
Пример #2
0
        public void Log4NetLogger_LoggingTest()
        {
            string message = "Error Message";
            Exception ex = new Exception();
            string messageFormat = "Message Format: message: {0}, exception: {1}";

            ILog log = new Log4NetLogger(GetType());
            Assert.IsNotNull(log);

            log.Debug(message);
            log.Debug(message, ex);
            log.DebugFormat(messageFormat, message, ex.Message);

            log.Error(message);
            log.Error(message, ex);
            log.ErrorFormat(messageFormat, message, ex.Message);

            log.Fatal(message);
            log.Fatal(message, ex);
            log.FatalFormat(messageFormat, message, ex.Message);

            log.Info(message);
            log.Info(message, ex);
            log.InfoFormat(messageFormat, message, ex.Message);

            log.Warn(message);
            log.Warn(message, ex);
            log.WarnFormat(messageFormat, message, ex.Message);
        }
	public void ConstructorWithMessageAndInnerExceptionWorks() {
		var inner = new Exception("a");
		var ex = new FormatException("The message", inner);
		Assert.IsTrue((object)ex is FormatException, "is FormatException");
		Assert.IsTrue(ReferenceEquals(ex.InnerException, inner), "InnerException");
		Assert.AreEqual(ex.Message, "The message");
	}
Пример #4
0
 /// <summary>
 /// Constructs an <see cref="LinkedINHttpResponseException"/>.
 /// </summary>
 /// <param name="expectedStatusCode">The expected <see cref="HttpStatusCode"/> of the response.</param>
 /// <param name="actualStatusCode">The actual <see cref="HttpStatusCode"/> of the response.</param>
 /// <param name="message">The message descriving the cause of this exception.</param>
 /// <param name="inner">The inner <see cref="Exception"/>.</param>
 public LinkedINHttpResponseException( HttpStatusCode expectedStatusCode, HttpStatusCode actualStatusCode, string message, Exception inner )
     : base(message, inner)
 {
     // set values
     ExpectedStatusCode = expectedStatusCode;
     ActualStatusCode = actualStatusCode;
 }
Пример #5
0
        /// <summary>
        /// Initialize the form
        /// </summary>
        public void Initialize(List<Oid> selectedOids)
        {
            mSelectedOids = selectedOids;

            // If no instances selected, inform and exit
            if (mSelectedOids == null || mSelectedOids.Count == 0)
            {
                string lMessageError = CultureManager.TranslateString(LanguageConstantKeys.L_NO_SELECTION, LanguageConstantValues.L_NO_SELECTION);
                Exception lException = new Exception(lMessageError, null);
                ScenarioManager.LaunchErrorScenario(lException);
                return;
            }

            cmbBoxSelectTemplate.SelectedIndexChanged += new EventHandler(HandlecmbBoxSelectTemplate_SelectedIndexChanged);

            // Load the templates from configuration file and fill the Combo
            LoadReportTemplates();

            // Show the number of selected instances in the Title.
            Text = CultureManager.TranslateStringWithParams(LanguageConstantKeys.L_ELEMENTSELECTED, LanguageConstantValues.L_ELEMENTSELECTED, mSelectedOids.Count);
            // Set the default printer
            lblNameOfPrint.Text = printDlg.PrinterSettings.PrinterName;

            ShowDialog();
        }
        public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
        {
            ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context);

            if (errorResponse.Code != null && errorResponse.Code.Equals("ListenerNotFound"))
            {
                return new ListenerNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
            }

            if (errorResponse.Code != null && errorResponse.Code.Equals("CertificateNotFound"))
            {
                return new CertificateNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
            }

            if (errorResponse.Code != null && errorResponse.Code.Equals("LoadBalancerNotFound"))
            {
                return new LoadBalancerNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
            }

            if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidConfigurationRequest"))
            {
                return new InvalidConfigurationRequestException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
            }

            return new AmazonElasticLoadBalancingException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
        }
Пример #7
0
        internal ResponseShim(IRestResponse resp,
                              IRequestShim req,
                              string baseUrl,
                              Exception error)
        {
            this.Request = req;

            if (resp != null)
            {
                this.Code = resp.StatusCode;
                this.Message = resp.StatusDescription;
                //this.Content = Convert.ToBase64String(resp.RawBytes);
                this.Content = UTF8Encoding.UTF8.GetString(
                                resp.RawBytes, 0, resp.RawBytes.Length);
                this.IsSuccess = resp.IsSuccess;
            }

            this.BaseUrl = baseUrl;
            this.Error = error;

            var restErr = error as RestServiceException;
            if (restErr != null)
            {
                this.Code = restErr.Code;
                this.Message = restErr.Message;
            }
        }
		public void HandleConnectionError(Exception exception, PluginProfileErrorCollection errors)
		{
			_log.GetLogger("Mercurial").Warn("Check connection failed", exception);
			exception = exception.InnerException ?? exception;
			const string uriFieldName = "Uri";
			if (exception is MercurialExecutionException)
			{
                errors.Add(new PluginProfileError { FieldName = "Login", Message = ExtractValidErrorMessage(exception)});
                errors.Add(new PluginProfileError { FieldName = "Password", Message = ExtractValidErrorMessage(exception) });
                errors.Add(new PluginProfileError { FieldName = uriFieldName, Message = ExtractValidErrorMessage(exception) });
				return;
			}

            if (exception is ArgumentNullException || exception is DirectoryNotFoundException)
			{
				errors.Add(new PluginProfileError{ FieldName = uriFieldName, Message = INVALID_URI_OR_INSUFFICIENT_ACCESS_RIGHTS_ERROR_MESSAGE });
			}

            if (exception is MercurialMissingException)
            {
                errors.Add(new PluginProfileError { Message = MERCURIAL_IS_NOT_INSTALLED_ERROR_MESSAGE });
            }

			var fieldName = string.Empty;
			if (exception is InvalidRevisionException)
			{
				fieldName = "Revision";
			}

			errors.Add(new PluginProfileError {FieldName = fieldName, Message = exception.Message});
		}
        public static double CalculateGeometricSum(double ratio, double firstTerm, int seriesLength, int startTermNumber)
        {
            double sum = 0;
            seriesLength++;
            int nLength = seriesLength - startTermNumber;

            if(ratio == 1)
            {
                Exception ratiois1 = new Exception("The ratio is not allowed to equal 1");
                throw ratiois1;
            }

            if(startTermNumber > 1)
            {
                seriesLength--;
                nLength = seriesLength;
                sum = firstTerm * ((1 - Math.Pow(ratio, nLength)) / (1 - ratio));
                nLength = startTermNumber;
                sum -= firstTerm * ((1 - Math.Pow(ratio, nLength)) / (1 - ratio));
                return sum;
            }

            sum = firstTerm * ((1 - Math.Pow(ratio, nLength)) / (1 - ratio));

            return sum;
        }
Пример #10
0
        //Can only be called inside a service
        public static void PromoteException(Exception error,MessageVersion version,ref Message fault)
        {
            StackFrame frame = new StackFrame(1);

             Type serviceType = frame.GetMethod().ReflectedType;
             PromoteException(serviceType,error,version,ref fault);
        }
 public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
 {
     ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
     if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterException"))
     {
         return new InvalidParameterException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededException"))
     {
         return new LimitExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("OperationAbortedException"))
     {
         return new OperationAbortedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceAlreadyExistsException"))
     {
         return new ResourceAlreadyExistsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("ServiceUnavailableException"))
     {
         return new ServiceUnavailableException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     return new AmazonCloudWatchLogsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
 }
Пример #12
0
        /// <summary>
        /// Sends an error message by opening the user's mail client.
        /// </summary>
        /// <param name="recipient"></param>
        /// <param name="subject"></param>
        /// <param name="ex"></param>
        /// <param name="assembly">The assembly where the error originated. This will 
        /// be used to extract version information.</param>
        public static void SendByMail(string recipient, string subject, Exception ex,
            Assembly assembly, StringDictionary additionalInfo)
        {
            string attributes = GetAttributes(additionalInfo);

            StringBuilder msg = new StringBuilder();

            msg.AppendLine("[ Please send this as plain text to allow automatic pre-processing ]");
            msg.AppendLine();
            msg.AppendLine(GetMessage(ex));
            msg.AppendLine();
            msg.AppendLine(GetAttributes(additionalInfo));
            msg.AppendLine();
            msg.AppendLine("[ Please send this as plain text to allow automatic pre-processing ]");
            msg.AppendLine();

            string command = string.Format("mailto:{0}?subject={1}&body={2}",
                recipient,
                Uri.EscapeDataString(subject),
                Uri.EscapeDataString(msg.ToString()));

            Debug.WriteLine(command);
            Process p = new Process();
            p.StartInfo.FileName = command;
            p.StartInfo.UseShellExecute = true;

            p.Start();
        }
Пример #13
0
 public void SyncWebBrowserError(Exception ex)
 {
     InvokeOnMainThread(() => {
         UIAlertView alertView = new UIAlertView("Sync Web Browser Error", ex.Message, null, "OK", null);
         alertView.Show();
     });
 }
Пример #14
0
        public void WriteLog(ICorrelation correlation, LogEventLevel eventLevel, Exception exception, string formatMessage, params object[] args)
        {
            if (log == null)
            {
                log = loggerRepository.GetLogger(sourceType);
            }

            if (eventLevel == LogEventLevel.Verbose && !log.IsDebugEnabled)
            {
                return;
            }

            if (args != null && args.Length != 0)
            {
                formatMessage = string.Format(formatMessage, args);
            }

            log4net.Core.ILogger logger = log.Logger;

            LoggingEvent logEvent = new LoggingEvent(sourceType, logger.Repository, logger.Name, MapEventLevel(eventLevel), formatMessage, exception);

            if (correlation != null)
            {
                logEvent.Properties["CallerId"] = correlation.CallerId;
                logEvent.Properties["CorrelationId"] = correlation.CorrelationId;
            }

            logger.Log(logEvent);
        }
 protected void ReportError(Exception e)
 {
     if (Errored != null)
     {
         Errored(this, new ErrorEventArgs(e));
     }
 }
Пример #16
0
        public void End(Exception ex = null)
        {
            if (ex == null)
                sessionFactory.SaveChanges();

            sessionFactory.Dispose();
        }
Пример #17
0
 /// <summary>
 /// Initializes a new instance of the PipelineException class with the specified error message and a reference to the inner exception that is the cause of this exception.
 /// </summary>
 /// <param name="message">A message that describes the error.</param>
 /// <param name="innerException">The exception that is the cause of the current exception. If innerException is not a null reference, the current exception is raised in a catch block that handles the inner exception.</param>
 public PipelineException(
     string message,
     Exception innerException
     )
     :base(message, innerException)
 {
 }
Пример #18
0
        public decimal GetWeeklySalary(string employeeId, int weeks)
        {
            string connString = string.Empty;
              string employeeName = String.Empty;
              decimal salary = 0;
              try
              {
            // Access the database to get the salary for this employee.

            connString = ConfigurationManager.ConnectionStrings
                                  ["EmployeeDatabase"].ConnectionString;
            // ... etc.
            // In this example, just assume it's some large number.
            employeeName = "Jose Lopez";
            salary = 1000000;
            return salary / weeks;
              }
              catch (Exception ex)
              {
            // Provide error information for debugging.
            string template = "Error en el cálculo del salario de {0}. " +
                          "Salario: {1}. Semanas: {2}\n" +
                          "Conexion: {3}\n" +
                          "{4}";
            // Create a new exception to return.
            Exception informationException = new Exception(
              string.Format(template, employeeName, salary, weeks, connString, ex.Message));
            throw informationException;
              }
        }
 /// <summary>
 /// Unmarshaller error response to exception.
 /// </summary>  
 /// <param name="context"></param>
 /// <param name="innerException"></param>
 /// <param name="statusCode"></param>
 /// <returns></returns>
 public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
 {
     ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
     if (errorResponse.Code != null && errorResponse.Code.Equals("InternalErrorException"))
     {
         return new InternalErrorException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterException"))
     {
         return new InvalidParameterException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("NotAuthorizedException"))
     {
         return new NotAuthorizedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotFoundException"))
     {
         return new ResourceNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
     {
         return new TooManyRequestsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     return new AmazonCognitoIdentityException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
 }
 private void LogException(Exception ex)
 {
     if (MvcApplication.Logger != null)
     {
         MvcApplication.Logger.Error("MyCustomHandleError ", ex);
     }
 }
 public ObjectDataSourceStatusEventArgs(object returnValue, IDictionary outputParameters, System.Exception exception)
 {
     this._affectedRows = -1;
     this._returnValue = returnValue;
     this._outputParameters = outputParameters;
     this._exception = exception;
 }
Пример #22
0
 public static Exception/*!*/ NonBlockingError(RubyContext/*!*/ context, Exception/*!*/ exception, bool isRead) {
     RubyModule waitReadable;
     if (context.TryGetModule(isRead ? typeof(WaitReadable) : typeof(WaitWritable), out waitReadable)) {
         ModuleOps.ExtendObject(waitReadable, exception);
     }
     return exception;
 }
    public override string FormatException(Exception exception)
    {
      while (exception is TargetInvocationException)
      {
        exception = exception.InnerException;
      }
      Builtins.lastException = exception;

      if (exception is Builtins.Continuation)
      {
        // cheat
        return @"&implementation-restriction
&message:             continuations cannot be used in this way, sorry :(";
      }

      if (exception is ThreadAbortException)
      {
        return "evaluation aborted";
      }

      if (exception is SchemeException)
      {
        return exception.ToString();
      }

      var w = new IronScheme.Runtime.StringWriter();
      w.WriteLine("Unhandled CLR exception reading input:");
      "(display {0} {1})".Eval(exception, w);
      return w.GetBuffer();
    }
        internal static bool CrashIfFailFastEnabled(Exception exception)
        {
            if (!IsFailFastEnabled)
            {
                return false;
            }

            if (exception is NotImplementedException)
            {
                // This is part of the dispatcher mechanism.  A NotImplementedException indicates
                // that another component should handle the call.
                return false;
            }

            var dkmException = exception as DkmException;
            if (dkmException != null)
            {
                switch (dkmException.Code)
                {
                    case DkmExceptionCode.E_PROCESS_DESTROYED:
                    case DkmExceptionCode.E_XAPI_REMOTE_CLOSED:
                    case DkmExceptionCode.E_XAPI_REMOTE_DISCONNECTED:
                    case DkmExceptionCode.E_XAPI_COMPONENT_DLL_NOT_FOUND:
                        return false;
                }
            }

            return FatalError.Report(exception);
        }
public void TraverseForThrowsArgumentNullException861()
{
    Exception exception;
    object o;
    exception = new Exception();
    o = this.TraverseFor<object>(exception);
}
Пример #26
0
		private static ExceptionPolicyImpl GetExceptionPolicy(Exception exception, string policyName)
		{
			try
			{
				return factory.Create(policyName);				
			}
			catch(ConfigurationErrorsException configurationException)
			{
                try
                {
                    DefaultExceptionHandlingEventLogger logger = EnterpriseLibraryFactory.BuildUp<DefaultExceptionHandlingEventLogger>();
                    logger.LogConfigurationError(configurationException, policyName);
                }
                catch { }

                throw;
			}
            catch (Exception ex)
			{
                try
                {
                    string exceptionMessage = ExceptionUtility.FormatExceptionHandlingExceptionMessage(policyName, ex, null, exception);

                    DefaultExceptionHandlingEventLogger logger = EnterpriseLibraryFactory.BuildUp<DefaultExceptionHandlingEventLogger>();
                    logger.LogInternalError(policyName, exceptionMessage);
                }
                catch { }
				
                throw new ExceptionHandlingException(ex.Message, ex);
			}			
		}        
Пример #27
0
 private void RepoteUnhandleException(Exception ex)
 {
     Button b= new Button() ;
     Window w = new Window {Width = 0x258,Height = 0x1f4,Padding = new Thickness(0x14),Title = String.Format("{0} - {1}","予期せぬエラー","TwVideoUp")};
     StackPanel m = new StackPanel()
     {
         Orientation = Orientation.Vertical,
         Children =
         {
             new TextBlock()
             {
                 Text = "予期せぬエラーが発生しました。以下のStackTraceをIssueとして提出いただけると嬉しいです。(ユーザー名などが含まれている場合は伏せていただいて構いません。)",
                 TextWrapping = TextWrapping.Wrap
             },
             new TextBox()
             {
                 Text = ex.ToString(),
                 IsReadOnly = true,
                 TextWrapping = TextWrapping.Wrap,
                 Margin = new Thickness(10),
                 MaxHeight = 380,
                 VerticalScrollBarVisibility = ScrollBarVisibility.Auto
             },
             b
         },
     };
     b.Click += (sender, args) => Clipboard.SetText(ex.ToString());
     b.Content = new TextBlock() {Text = "Copy to Clipboard."};
     w.Content = m;
     w.ShowDialog();
     Shutdown();
 }
       public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
       {
         ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);                    
         
         if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotFoundException"))
         {
           return new ResourceNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
         }
 
         if (errorResponse.Code != null && errorResponse.Code.Equals("MissingParameterValueException"))
         {
           return new MissingParameterValueException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
         }
 
         if (errorResponse.Code != null && errorResponse.Code.Equals("ServiceUnavailableException"))
         {
           return new ServiceUnavailableException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
         }
 
         if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterValueException"))
         {
           return new InvalidParameterValueException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
         }
 
         return new AmazonGlacierException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
       }
Пример #29
0
        static StringBuilder BuildExceptionReport(Exception e, StringBuilder sb, int d)
        {
            if (e == null)
                return sb;

            sb.AppendFormat("Exception of type `{0}`: {1}", e.GetType().FullName, e.Message);

            var tle = e as TypeLoadException;
            if (tle != null)
            {
                sb.AppendLine();
                Indent(sb, d);
                sb.AppendFormat("TypeName=`{0}`", tle.TypeName);
            }
            else // TODO: more exception types
            {
            }

            if (e.InnerException != null)
            {
                sb.AppendLine();
                Indent(sb, d); sb.Append("Inner ");
                BuildExceptionReport(e.InnerException, sb, d + 1);
            }

            sb.AppendLine();
            Indent(sb, d); sb.Append(e.StackTrace);

            return sb;
        }
 /// <summary>
 /// Unmarshaller error response to exception.
 /// </summary>  
 /// <param name="context"></param>
 /// <param name="innerException"></param>
 /// <param name="statusCode"></param>
 /// <returns></returns>
 public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
 {
     ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
     if (errorResponse.Code != null && errorResponse.Code.Equals("AccessDeniedException"))
     {
         return new AccessDeniedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("InternalException"))
     {
         return new InternalException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidInputException"))
     {
         return new InvalidInputException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("NoSuchEntityException"))
     {
         return new NoSuchEntityException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("OperationInProgressException"))
     {
         return new OperationInProgressException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     return new AmazonInspectorException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
 }