本文整理汇总了C#中ErrorType类的典型用法代码示例。如果您正苦于以下问题:C# ErrorType类的具体用法?C# ErrorType怎么用?C# ErrorType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ErrorType类属于命名空间,在下文中一共展示了ErrorType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Index
//
// GET: /Error/
public ActionResult Index(ErrorType? errorType)
{
string title, description;
// set the default error type
if (errorType == null) { errorType = ErrorType.UnknownError; }
switch (errorType)
{
case ErrorType.UnauthorizedAccess:
title = "Unauthorized Access";
description = "You are not authorized for your request.";
break;
case ErrorType.FileDoesNotExist:
title = "File Does Not Exist";
description = "File not found.";
break;
case ErrorType.FileNotFound:
title = "File Does Not Exist";
description = "File not found.";
break;
case ErrorType.StudentNotFound:
title = "Student not found";
description = "The student you are looking for was not found.";
break;
default:
title = "Unknown Error.";
description = "An unknown error has occurred. IT has been notified of the issue.";
break;
};
return View(ErrorViewModel.Create(title, description));
}
示例2: LogManager
public LogManager(ErrorType writeToConsole = ErrorType.ERROR, ErrorType writeToFile = ErrorType.ERROR, String logPath = null, bool writeDateTime = false)
{
this.logPath = logPath ?? AppDomain.CurrentDomain.BaseDirectory + "logFile.log";
this.writeToConsole = writeToConsole;
this.writeToFile = writeToFile;
this.writeDateTime = writeDateTime;
}
示例3: Error
public Error(string Message, ErrorType Type, int Pos, int Line)
{
this.Message = Message;
Position = Pos;
this.Line = Line;
this.Type = Type;
}
示例4: ParseException
/**
* Creates a new parse exception.
*
* @param type the parse error type
* @param info the additional information
* @param line the line number, or -1 for unknown
* @param column the column number, or -1 for unknown
*/
public ParseException(ErrorType type,
string info,
int line,
int column)
: this(type, info, null, line, column)
{
}
示例5: Error
public static void Error(string msg, Exception e, ErrorType type)
{
string exception_message = "";
if (e != null)
exception_message = "Error: " + e.Message;
if (messages_level != MessagesLevel.MessagesNone &&
!(messages_level == MessagesLevel.MessagesBasic && type != ErrorType.FatalError && type != ErrorType.Connect))
{
if (type == ErrorType.Connect)
{
//Use specific Error dialog to allow changing of preferences
CustomMsgBox msgbox=new CustomMsgBox(msg + "\n" + exception_message,"FlickrSync Error");
msgbox.AddButton("OK", 75, 1, msgbox.ButtonCallOK);
msgbox.AddButton("Preferences",75,2,ButtonCallPref);
msgbox.ShowDialog();
}
else
MessageBox.Show(msg + "\n" + exception_message, "Error");
}
string logmsg=msg+"; "+exception_message;
if (type == ErrorType.FatalError || type == ErrorType.Connect)
Log(LogLevel.LogBasic, logmsg);
else
Log(LogLevel.LogAll, logmsg);
if (type==ErrorType.FatalError || type==ErrorType.Connect)
Application.Exit();
}
示例6: ErrorResponse
public ErrorResponse(ErrorType errorType, string description = null, Uri errorUri = null, HttpStatusCode statusCode = HttpStatusCode.BadRequest)
{
_errorType = errorType;
_statusCode = statusCode;
_description = description;
_errorUri = errorUri;
}
示例7: BigStashException
public BigStashException(string message,
ErrorType errorType = ErrorType.NotSet,
ErrorCode errorCode = ErrorCode.NotSet)
: base(message)
{
this.ErrorType = errorType; this.ErrorCode = errorCode;
}
示例8: DisplayBadCommandError
static void DisplayBadCommandError(ErrorType type = ErrorType.General)
{
string[] potentials;
switch (type)
{
case ErrorType.InvalidGrab:
potentials = new[] {"I can't take that!", "How would I do that?"};
break;
case ErrorType.InvalidItem:
potentials = new[] {"What is that?", "I don't see that"};
break;
case ErrorType.InvalidLocation:
potentials = new string[] {"Where?", "I can't go there!"};
break;
case ErrorType.InvalidUse:
potentials = new string[]
{"How am I supposed to do that?", "I'm sorry Dave, I'm afraid I can't do that."};
break;
case ErrorType.InvalidSingleUse:
potentials = new string[]{"On what?"};
break;
case ErrorType.General:
default:
potentials = new string[] {"Now you're just talking nonsense!", "What?"};
break;
}
Terminal.WriteLine(potentials[new Random().Next(potentials.Count())]);
}
示例9: ErrorInfo
public ErrorInfo(string propertyName, string errorMessage, object onObject, ErrorType errorType)
{
this.PropertyName = propertyName;
this.ErrorMessage = errorMessage;
this.Object = onObject;
this.ErrorType = errorType;
}
示例10: OISException
/// <summary>
/// Initializes a new instance of the <see cref="OISException"/> class.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="errorType">Type of the error.</param>
/// <param name="line">The line.</param>
/// <param name="filename">The filename.</param>
public OISException(string message, ErrorType errorType, int line, string filename)
: base(message)
{
ErrorType = errorType;
Line = line;
Filename = filename;
}
示例11: CodeError
public CodeError(ErrorType Type, ErrorLevel Level, CodeLine Line, string Remarks = "")
{
this.Type = Type;
this.Level = Level;
this.Line = Line;
this.Remarks = Remarks;
}
示例12: Error
public Error(string description, ErrorType errorType) {
if (string.IsNullOrEmpty(description)) {
throw new ArgumentNullException("description", "Error descriptions cannot be Null or empty.");
}
this._description = description;
this._errorType = errorType;
}
示例13: ResolveErrorMessage
private static string ResolveErrorMessage(ErrorType error)
{
switch (error)
{
case ErrorType.RecordingFailed:
return Application.Context.Resources.GetString(Resource.String.RecordingFailedTip);
case ErrorType.NoNetworkConnection:
return Application.Context.Resources.GetString(Resource.String.NoNetworkConnectionTip);
case ErrorType.NoServerConnection:
return Application.Context.Resources.GetString(Resource.String.NoServerConnectionTip);
case ErrorType.SendingFailed:
return Application.Context.Resources.GetString(Resource.String.SendingFailedTip);
case ErrorType.StoreFailed:
return Application.Context.Resources.GetString(Resource.String.StoreFailedTip);
case ErrorType.WriteFailed:
return Application.Context.Resources.GetString(Resource.String.WriteFailedTip);
case ErrorType.ReadFailed:
return Application.Context.Resources.GetString(Resource.String.ReadFailedTip);
case ErrorType.CheckFailed:
return Application.Context.Resources.GetString(Resource.String.CheckFailedTip);
case ErrorType.DeleteFailed:
return Application.Context.Resources.GetString(Resource.String.DeleteFailedTip);
case ErrorType.RecorderInitializationError:
return Application.Context.Resources.GetString(Resource.String.RecorderInitializationErrorTip);
default:
throw new ArgumentOutOfRangeException("error");
}
}
示例14: Error
public Error(string pMessage, ErrorType type, int lineNr, int linePosition)
: base(pMessage)
{
m_type = type;
m_lineNr = lineNr;
m_linePosition = linePosition;
}
示例15: RaiseError
public void RaiseError(IFormattable message, ErrorType errorType, JSchema schema, object value, IList<ValidationError> childErrors)
{
ValidationError error = CreateError(message, errorType, schema, value, childErrors);
// shared cache information that could be read/populated from multiple threads
// lock to ensure that only one thread writes known schemas
if (Schema.KnownSchemas.Count == 0)
{
lock (Schema.KnownSchemas)
{
if (Schema.KnownSchemas.Count == 0)
{
JSchemaDiscovery discovery = new JSchemaDiscovery(Schema.KnownSchemas, KnownSchemaState.External);
discovery.Discover(Schema, null);
}
}
}
PopulateSchemaId(error);
SchemaValidationEventHandler handler = ValidationEventHandler;
if (handler != null)
handler(_publicValidator, new SchemaValidationEventArgs(error));
else
throw JSchemaValidationException.Create(error);
}