• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# System.Exception类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: GetExceptionResponse

        private static Protobuf.Exception GetExceptionResponse(Exception exc)
        {
            Alachisoft.NCache.Common.Protobuf.Exception ex = new Alachisoft.NCache.Common.Protobuf.Exception();
            ex.message = exc.Message;
            ex.exception = exc.ToString();

            if (exc is OperationFailedException)
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.OPERATIONFAILED;
            else if (exc is Runtime.Exceptions.AggregateException)
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.AGGREGATE;
            else if (exc is ConfigurationException)
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.CONFIGURATION;
            else if (exc is OperationNotSupportedException)
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.NOTSUPPORTED;
            else if (exc is TypeIndexNotDefined)
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.TYPE_INDEX_NOT_FOUND;
            else if (exc is AttributeIndexNotDefined)
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.ATTRIBUTE_INDEX_NOT_FOUND;
            else if (exc is StateTransferInProgressException)
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.STATE_TRANSFER_EXCEPTION;
            else
                ex.type = Alachisoft.NCache.Common.Protobuf.Exception.Type.GENERALFAILURE;
            return ex;
        }
开发者ID:javithalion,项目名称:NCache,代码行数:24,代码来源:ResponseHelper.cs


示例17: SetException

 /// <summary>Record that an exception occurred while executing
 /// this merge 
 /// </summary>
 internal virtual void SetException(System.Exception error)
 {
     lock (this)
     {
         this.error = error;
     }
 }
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:10,代码来源:MergePolicy.cs


示例18: MismatchedNotSetException

 public MismatchedNotSetException(string message, BitSet expecting, IIntStream input, Exception innerException)
     : base(message, expecting, input, innerException)
 {
 }
开发者ID:EightPillars,项目名称:PathwayEditor,代码行数:4,代码来源:MismatchedNotSetException.cs


示例19: RecognitionException

        public RecognitionException(string message, IIntStream input, Exception innerException)
            : base(message, innerException)
        {
            this._input = input;
            if (input != null)
            {
                this._index = input.Index;
                if (input is ITokenStream)
                {
                    this._token = ((ITokenStream)input).LT(1);
                    this._line = _token.Line;
                    this._charPositionInLine = _token.CharPositionInLine;
                }

                ITreeNodeStream tns = input as ITreeNodeStream;
                if (tns != null)
                {
                    ExtractInformationFromTreeNodeStream(tns);
                }
                else
                {
                    ICharStream charStream = input as ICharStream;
                    if (charStream != null)
                    {
                        this._c = input.LA(1);
                        this._line = ((ICharStream)input).Line;
                        this._charPositionInLine = ((ICharStream)input).CharPositionInLine;
                    }
                    else
                    {
                        this._c = input.LA(1);
                    }
                }
            }
        }
开发者ID:biddyweb,项目名称:azfone-ios,代码行数:35,代码来源:RecognitionException.cs


示例20: ToolMessage

 public ToolMessage(ErrorType errorType, Exception e, params object[] args)
     : base(errorType, e, new CommonToken(TokenTypes.Invalid), args)
 {
 }
开发者ID:sharwell,项目名称:antlr4cs,代码行数:4,代码来源:ToolMessage.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# System.Func类代码示例发布时间:2022-05-24
下一篇:
C# System.EventArgs类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap