本文整理汇总了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;
}
示例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;
}
示例3: Exception
public Exception(System.Exception ex)
{
InitializeComponent();
_exception = ex;
lblContent.Text = ex.ToString();
Activate();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
// }
}
}
示例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;
}
示例9: Exception
public Exception(System.Exception ex)
{
InitializeComponent();
DwmDropShadow.DropShadowToWindow(this);
_exception = ex;
lblContent.Text = ex.ToString();
}
示例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();
}
示例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 );
}
}
示例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());
}
示例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();
}
示例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;
}
示例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;
}
}
}