本文整理汇总了C#中ExceptionType类的典型用法代码示例。如果您正苦于以下问题:C# ExceptionType类的具体用法?C# ExceptionType怎么用?C# ExceptionType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExceptionType类属于命名空间,在下文中一共展示了ExceptionType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ModbusException
internal ModbusException(int DeviceAddress, FunctionCode FunctionCode, ExceptionType Type, string Comment = null)
{
this.Type = Type;
this.DeviceAddress = DeviceAddress;
this.Code = FunctionCode;
this.Comment = Comment;
}
示例2: ExceptionLogger
// modloader errors can be constructed without parameters
public ExceptionLogger()
{
this.version = ModLoader.getVersion();
this.url = "http://mods.scrollsguide.com";
this.type = ExceptionType.MODLOADER;
}
示例3: Log
public static Exception Log(Exception error, ExceptionType type, OutputHandler OutputCallback)
{
lock (Lock)
{
OutputHandler callback = new OutputHandler(delegate(Exception e, ExceptionType t) { });
Errors.Add(new ExceptionItem(error, type));
if (Output != null)
{
callback = Output;
}
if (OutputCallback != null)
{
callback = OutputCallback;
}
if (callback != null)
{
callback(error, type);
}
Logger.Log(">> Exception Detected >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
//System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace();
//for (int i = 0; i < st.FrameCount; i++)
//{
// System.Diagnostics.StackFrame sf = st.GetFrame(i);
// Logger.Log(String.Format(">> File name:{0}\tLine:{1}\tColumn:{2}\tMethodName:{3} ", sf.GetFileName(), sf.GetFileLineNumber(), sf.GetFileColumnNumber(), sf.GetMethod().Name));
//}
Logger.Log(error.ToString());
}
return error;
}
示例4: 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();
}
示例5: EEPException
/************************************************************************
* type: 抛出的异常类型
* sourceType: 抛出异常所在的类
* sourceID: 抛出异常所在的控件ID,没有ID则为null
* key: 参数的名称(参数错误)
* 属性的名称(属性错误)
* 方法的名称(方法错误)
* 控件的类型名(控件错误)
* 字段的名称(字段错误)
* value: 参数的值(参数错误)
* 属性的值(属性错误)
* null(方法错误)
* 控件的ID(Component没有ID则为null)(控件错误)
* 字段的值(字段错误)
************************************************************************/
/// <summary>
///
/// </summary>
/// <param name="type"></param>
/// <param name="sourceType"></param>
/// <param name="key"></param>
/// <param name="value"></param>
/// <param name="controlID"></param>
public EEPException(ExceptionType type, Type sourceType, string sourceID, string key, string value)
{
_type = type;
_sourceType = sourceType;
_sourceID = sourceID;
_key = key;
_value = value;
}
示例6: StylesSheetException
/// <summary>
/// Initializes a new instance of the <see cref="T:StylesSheetException"/> class.
/// </summary>
/// <param name="type">The type.</param>
/// <param name="controlName">Name of the control.</param>
/// <param name="styleName">Name of the style.</param>
public StylesSheetException(ExceptionType type, string styleName, string controlName, string propertyName, string propertyValue)
{
this.type = type;
this.styleName = styleName;
this.controlName = controlName;
this.propertyName = propertyName;
this.propertyValue = propertyValue;
}
示例7: EngineException
public EngineException(ExceptionType type, string message, Token token)
{
Type = type;
Message = message;
Token = token;
Line = token.Line;
Position = token.Position;
}
示例8: CreateException
internal static Exception CreateException(string res, string[] args, ExceptionType exceptionType, int lineNo, int linePos)
{
switch (exceptionType)
{
case ExceptionType.ArgumentException:
return new ArgumentException(Res.GetString(res, args));
}
return new XmlException(res, args, lineNo, linePos);
}
示例9: Read
public static RemotingException Read(Serializer iprot)
{
string message = null;
ExceptionType type = ExceptionType.Unknown;
message = iprot.ReadString();
type = (ExceptionType)iprot.ReadI32();
return new RemotingException(type, message);
}
示例10: LogException
public void LogException(Exception exception, HttpRequest httpRequest, ExceptionType exceptionType = ExceptionType.Handled)
{
if (exceptionType == ExceptionType.Unhandled)
{
Fatal(ExceptionToString(exception), exception, httpRequest);
}
else
{
Error(ExceptionToString(exception), exception, httpRequest);
}
}
示例11: HotCitException
public HotCitException(ExceptionType type, string msg = "")
{
switch (type) {
case ExceptionType.BadAction: throw new BadActionException(msg);
case ExceptionType.IllegalInput: throw new IllegalInputException(msg);
case ExceptionType.IllegalState: throw new IllegalStateException(msg);
case ExceptionType.Impossible: throw new ImpossibleException(msg);
case ExceptionType.NotEnoughGold: throw new NotEnoughGoldException(msg);
case ExceptionType.NotFound: throw new NotFoundException(msg);
case ExceptionType.Timeout: throw new TimeoutException(msg);
}
}
示例12: Read
public static TApplicationException Read(TProtocol iprot)
{
TField field;
string message = null;
ExceptionType type = ExceptionType.Unknown;
iprot.ReadStructBegin();
while (true)
{
field = iprot.ReadFieldBegin();
if (field.Type == TType.Stop)
{
break;
}
switch (field.ID)
{
case 1:
if (field.Type == TType.String)
{
message = iprot.ReadString();
}
else
{
TProtocolUtil.Skip(iprot, field.Type);
}
break;
case 2:
if (field.Type == TType.I32)
{
type = (ExceptionType)iprot.ReadI32();
}
else
{
TProtocolUtil.Skip(iprot, field.Type);
}
break;
default:
TProtocolUtil.Skip(iprot, field.Type);
break;
}
iprot.ReadFieldEnd();
}
iprot.ReadStructEnd();
return new TApplicationException(type, message);
}
示例13: SetMessageOnType
private void SetMessageOnType(ExceptionType type, string message)
{
switch (type)
{
case ExceptionType.MethodChainingException:
_template = "You can not chain these methods : {0}";
break;
case ExceptionType.ArgumentNotMatchException:
_template = "argument not match : {0}";
break;
case ExceptionType.MemberSerializeException:
_template = "the colum member can not be serialized to string: {0}";
break;
default:
_template = "{0}";
break;
}
_message = string.Format(_template, message);
}
示例14: 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);
}
示例15: BroadcastExceptionNotification
internal static void BroadcastExceptionNotification(ExceptionType type, int token)
{
switch (type)
{
case ExceptionType.StandardException:
{
BroadcastMessage("exception:id=1," + token);
break;
}
case ExceptionType.FatalException:
{
BroadcastMessage("exception:id=2," + token);
break;
}
case ExceptionType.SQLException:
{
BroadcastMessage("exception:id=3," + token);
break;
}
case ExceptionType.ThreadedException:
{
BroadcastMessage("exception:id=4," + token);
break;
}
case ExceptionType.UserException:
{
BroadcastMessage("exception:id=5," + token);
break;
}
case ExceptionType.DDOSException:
{
BroadcastMessage("exception:id=6," + token);
break;
}
}
}