当前位置: 首页>>代码示例>>C#>>正文


C# ExceptionType.ToString方法代码示例

本文整理汇总了C#中ExceptionType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ExceptionType.ToString方法的具体用法?C# ExceptionType.ToString怎么用?C# ExceptionType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ExceptionType的用法示例。


在下文中一共展示了ExceptionType.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CustomException

 /// <summary>
 /// 
 /// </summary>
 /// <param name="exType">Type of ExceptionType.</param>
 /// <param name="message">The error message for this exception.</param>
 /// <param name="innerException">The inner exception that is wrapped in this exception.</param>
 public CustomException(ExceptionType exType, string message, System.Exception innerException)
     : base(message, innerException)
 {
     //this.CustomMessage = rm.GetString(exType.ToString());
     this.CustomMessage = ExpResources.ExpResources.ResourceManager.GetString(exType.ToString()) ?? "[[" + exType.ToString() + "]]";
     this.ExceptionType = exType.ToString();
 }
开发者ID:sbudihar,项目名称:SIRIUSrepo,代码行数:13,代码来源:CustomException.cs

示例2: QStrategyException

        public QStrategyException(string message, Exception innerException, ExceptionType exceptionType, string sourceLocation)
            : base(message, innerException)
        {
            this.exceptionType = exceptionType;
            this.sourceLocation = sourceLocation;
            string messageDetail = message;
            message = exceptionType.ToString();
            if (innerException != null)
            {
                while (innerException.InnerException != null)
                {
                    innerException = innerException.InnerException;
                }
                message = innerException.Message;
                messageDetail = innerException.StackTrace;
            }

            string messageLog = string.Format("ExceptionType: {0}, Source:{1}, Exception:{2} MessageDetails: {3}", ExceptionType.ToString(), sourceLocation, message, messageDetail);
            LogUtil.WriteLog(LogLevel.ERROR, messageLog);
        }
开发者ID:EZXInc,项目名称:celera-gui,代码行数:20,代码来源:QStrategyException.cs

示例3: HandleException

        private static void HandleException(ExceptionType exceptionType, Exception exception, string source)
        {
            using (var eventLog = new EventLog())
            {
                if (!System.Diagnostics.EventLog.SourceExists(source))
                {
                    System.Diagnostics.EventLog.CreateEventSource(source, "Application");
                }
                eventLog.Source = source;
                eventLog.Log = "Application";

                StringBuilder message = new StringBuilder();
                message.AppendLine("A " + source + " " + exceptionType.ToString() + " occurred with the following details:");
                message.AppendLine();
                message.AppendLine(exception.Message);
                if (exception.InnerException != null)
                {
                    message.AppendLine();
                    message.AppendLine("InnerException:");
                    message.AppendLine(exception.InnerException.ToString());
                }
                message.AppendLine();
                message.AppendLine("StackTrace:");
                message.AppendLine(exception.StackTrace);

                eventLog.WriteEntry(message.ToString(), System.Diagnostics.EventLogEntryType.Error);

                StringBuilder returnMessage = new StringBuilder();
                returnMessage.AppendLine("Exception:");
                returnMessage.AppendLine(exception.Message);
                if (exception.InnerException != null)
                {
                    returnMessage.AppendLine();
                    returnMessage.AppendLine("Inner Exception:");
                    returnMessage.AppendLine(exception.InnerException.Message);
                }
            }
        }
开发者ID:crazycry0gen,项目名称:Aroma-Violet,代码行数:38,代码来源:ServiceHelpers.cs

示例4: TranslationException

 public TranslationException(ExceptionType eType, string message)
   : base(eType.ToString() + ": " + message) {
 }
开发者ID:lleraromero,项目名称:bytecodetranslator,代码行数:3,代码来源:TranslationException.cs

示例5: CheckExceptionType

 private void CheckExceptionType(ExceptionType type, Action action)
 {
     try {
         action.Invoke();
     }
     catch (ErrReportException e) {
         if (type == ExceptionType.Regular) {
             return;
         }
         Assert.Fail("Got and exption type {0} while expecting ", e.GetType().Name, type.ToString());
     }
     catch (FaultException<ErrReport> e) {
         if (type == ExceptionType.Fault) {
             return;
         }
         Assert.Fail("Got and exption type {0} while expecting ", e.GetType().Name, type.ToString());
     }
     catch (Exception e) {
         Assert.Fail("Got and exption type {0} while expecting ", e.GetType().Name, type.ToString());
     }
 }
开发者ID:MichaelRoop,项目名称:NET_TestHarness,代码行数:21,代码来源:ValidatorTests.cs


注:本文中的ExceptionType.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。