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


C# System.Exception类代码示例

本文整理汇总了C#中System.Exception的典型用法代码示例。如果您正苦于以下问题:C# System.Exception类的具体用法?C# System.Exception怎么用?C# System.Exception使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ANTLRMessage

 public ANTLRMessage([NotNull] ErrorType errorType, [Nullable] Exception e, IToken offendingToken, params object[] args)
 {
     this.errorType = errorType;
     this.e = e;
     this.args = args;
     this.offendingToken = offendingToken;
 }
开发者ID:sharwell,项目名称:antlr4cs,代码行数:7,代码来源:ANTLRMessage.cs

示例2: NoViableAltException

 public NoViableAltException(string message, string grammarDecisionDescription, int decisionNumber, int stateNumber, IIntStream input, Exception innerException)
     : base(message, input, innerException)
 {
     this._grammarDecisionDescription = grammarDecisionDescription;
     this._decisionNumber = decisionNumber;
     this._stateNumber = stateNumber;
 }
开发者ID:joelmartinez,项目名称:Jint.Phone,代码行数:7,代码来源:NoViableAltException.cs

示例3: Exception

 public Exception(System.Exception ex)
 {
     InitializeComponent();
     _exception = ex;
     lblContent.Text = ex.ToString();
     Activate();
 }
开发者ID:ChadSki,项目名称:Quickbeam,代码行数:7,代码来源:Exception.xaml.cs

示例4: TemplateLexerMessage

        IToken templateToken; // overall token pulled from group file

        #endregion Fields

        #region Constructors

        public TemplateLexerMessage(string srcName, string msg, IToken templateToken, Exception cause)
            : base(ErrorType.LEXER_ERROR, null, cause, null)
        {
            this.msg = msg;
            this.templateToken = templateToken;
            this.srcName = srcName;
        }
开发者ID:JSchofield,项目名称:antlrcs,代码行数:13,代码来源:TemplateLexerMessage.cs

示例5: TemplateLexerMessage

        private readonly IToken _templateToken; // overall token pulled from group file

        #endregion Fields

        #region Constructors

        public TemplateLexerMessage(string sourceName, string message, IToken templateToken, Exception cause)
            : base(ErrorType.LEXER_ERROR, null, cause, null)
        {
            this._message = message;
            this._templateToken = templateToken;
            this._sourceName = sourceName;
        }
开发者ID:mahanteshck,项目名称:antlrcs,代码行数:13,代码来源:TemplateLexerMessage.cs

示例6: TemplateCompiletimeMessage

 public TemplateCompiletimeMessage(ErrorType error, string sourceName, IToken templateToken, IToken token, Exception cause, object arg, object arg2)
     : base(error, null, cause, arg, arg2)
 {
     this._templateToken = templateToken;
     this._token = token;
     this._sourceName = sourceName;
 }
开发者ID:antlr,项目名称:antlrcs,代码行数:7,代码来源:TemplateCompileTimeMessage.cs

示例7: True

        /// <summary>
        /// True the specified shouldBeTrue and message.
        /// </summary>
        /// <param name="shouldBeTrue">If set to <c>true</c> should be true.</param>
        /// <param name="message">Message.</param>
        public static void True(bool shouldBeTrue, string message = null, AssertLevel assertLevel = AssertLevel.Warning, params string[] tags)
        {
            if(!shouldBeTrue)
            {
                if(string.IsNullOrEmpty(message))
                    message = "(No Message)";

                var logType = LogType.Warning;
                var fatalException = default(System.Exception);
                if(assertLevel == AssertLevel.Critical)
                {
                    logType = LogType.Error;
                }
                else if(assertLevel == AssertLevel.Fatal)
                {
                    logType = LogType.Exception;
                    fatalException = new System.Exception("Fatal Assert : " + message);
                }

                Logger.LogAssert("Assert Fail : " + message, logType, fatalException, tags);

                // just quit application if fatal assert is found
            //				if(assertLevel == AssertLevel.Fatal)
            //				{
            //					throw fatalException;
            //				}
            }
        }
开发者ID:TinnapopSonporm,项目名称:SinozeEngineBird,代码行数:33,代码来源:Assert.cs

示例8: TemplateMessage

 public TemplateMessage(ErrorType error, Template template, Exception source, object arg1, object arg2)
 {
     this.ErrorType = error;
     this.Template = template;
     this.Source = source;
     this.Argument1 = arg1;
     this.Argument2 = arg2;
 }
开发者ID:bszafko,项目名称:antlrcs,代码行数:8,代码来源:TemplateMessage.cs

示例9: Exception

        public Exception(System.Exception ex)
        {
            InitializeComponent();
            DwmDropShadow.DropShadowToWindow(this);
            _exception = ex;

            lblContent.Text = ex.ToString();
        }
开发者ID:Chrisco93,项目名称:Assembly,代码行数:8,代码来源:Exception.xaml.cs

示例10: MismatchedTokenException

        public MismatchedTokenException(string message, int expecting, IIntStream input, IList<string> tokenNames, Exception innerException)
            : base(message, input, innerException)
        {
            this._expecting = expecting;

            if (tokenNames != null)
                this._tokenNames = new List<string>(tokenNames).AsReadOnly();
        }
开发者ID:biddyweb,项目名称:azfone-ios,代码行数:8,代码来源:MismatchedTokenException.cs

示例11: PrintStackTrace

 public static void PrintStackTrace( Exception e, TextWriter writer )
 {
     writer.WriteLine( e.ToString() );
     string trace = e.StackTrace ?? string.Empty;
     foreach ( string line in trace.Split( '\n', '\r' ) )
     {
         if ( !string.IsNullOrEmpty( line ) )
             writer.WriteLine( "        " + line );
     }
 }
开发者ID:biddyweb,项目名称:azfone-ios,代码行数:10,代码来源:ExceptionExtensions.cs

示例12: TrackAppException

        public static void TrackAppException(string activity, String method, Exception exception, Boolean isFatalException)
        {
            var builder = new HitBuilders.ExceptionBuilder();
            var exceptionMessageToTrack = string.Format("{0}, Method : {1}\nException type : {2}, Exception Message : {3}\nStack Trace : \n{4}", activity, method,
                exception.GetType(),exception.Message, exception.StackTrace);

            builder.SetDescription(exceptionMessageToTrack);
            builder.SetFatal(isFatalException);

            Rep.Instance.GaTracker.Send(builder.Build());
        }
开发者ID:okrotowa,项目名称:Mosigra.Yorsh,代码行数:11,代码来源:GaService.cs

示例13: HandleExpected

 public void HandleExpected(Exception ex)
 {
     EasyTracker.Tracker.SendException(ex.Message, Throwable.FromException(ex), false);
     FlurryAgent.OnError(ex.GetType().Name, ex.Message, Throwable.FromException(ex));
     Crittercism.LogHandledException(Throwable.FromException(ex));
     Log.Error(_context.GetType().Name, ex.Message);
     string errorMessage = _context.Resources.GetString(Resource.String.CommonErrorMessage);
     AlertDialog dialog = new AlertDialog.Builder(_context).SetMessage(errorMessage).Create();
     dialog.SetCanceledOnTouchOutside(true);
     dialog.Show();
 }
开发者ID:es-repo,项目名称:wlpgnr,代码行数:11,代码来源:ExceptionHandler.cs

示例14: XmlPullParserException

		public XmlPullParserException(string msg, org.xmlpull.v1.XmlPullParser parser, System.Exception
			 chain) : base((msg == null ? string.Empty : msg + " ") + (parser == null ? string.Empty
			 : "(position:" + parser.getPositionDescription() + ") ") + (chain == null ? string.Empty
			 : "caused by: " + chain))
		{
			// for license please see accompanying LICENSE.txt file (available also at http://www.xmlpull.org/)
			if (parser != null)
			{
				this.row = parser.getLineNumber();
				this.column = parser.getColumnNumber();
			}
			this.detail = chain;
		}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:13,代码来源:XmlPullParserException.cs

示例15: BkgEnd

		private void BkgEnd(System.Exception e = null)
		{
			lock(this)
			{
				// if canceled and run again, maybe thread is not CurrentThread but running is true
				if (Thread.CurrentThread == thread)
				{
					// 1.
					thread = null;
					if (null != e)
					{
						exception = e;
					}
					// 2.
					running = false;
				}
			}
		}
开发者ID:vivence,项目名称:GhostStudio,代码行数:18,代码来源:ThreadPoolProc.cs


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