本文整理汇总了C#中ErrorType类的典型用法代码示例。如果您正苦于以下问题:C# ErrorType类的具体用法?C# ErrorType怎么用?C# ErrorType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ErrorType类属于命名空间,在下文中一共展示了ErrorType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
}
开发者ID:ucdavis,项目名称:CRP,代码行数:35,代码来源:ErrorController.cs
示例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;
}
开发者ID:bawaaaaah,项目名称:PonyLogManager,代码行数:7,代码来源:LogManager.cs
示例3: Error
public Error(string Message, ErrorType Type, int Pos, int Line)
{
this.Message = Message;
Position = Pos;
this.Line = Line;
this.Type = Type;
}
开发者ID:swarthy,项目名称:swarthystudio,代码行数:7,代码来源:LexicalAnalyzer.cs
示例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)
{
}
开发者ID:runner-mei,项目名称:mibble,代码行数:15,代码来源:ParseException.cs
示例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();
}
开发者ID:udif,项目名称:FlickrSync,代码行数:30,代码来源:FlickrSync.cs
示例6: ErrorResponse
public ErrorResponse(ErrorType errorType, string description = null, Uri errorUri = null, HttpStatusCode statusCode = HttpStatusCode.BadRequest)
{
_errorType = errorType;
_statusCode = statusCode;
_description = description;
_errorUri = errorUri;
}
开发者ID:simsod,项目名称:Nancy,代码行数:7,代码来源:ErrorResponse.cs
示例7: BigStashException
public BigStashException(string message,
ErrorType errorType = ErrorType.NotSet,
ErrorCode errorCode = ErrorCode.NotSet)
: base(message)
{
this.ErrorType = errorType; this.ErrorCode = errorCode;
}
开发者ID:yovannyr,项目名称:bigstash-windows,代码行数:7,代码来源:BigStashException.cs
示例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())]);
}
开发者ID:tj-miller,项目名称:Text-Adventure,代码行数:28,代码来源:RoomStatics.cs
示例9: ErrorInfo
public ErrorInfo(string propertyName, string errorMessage, object onObject, ErrorType errorType)
{
this.PropertyName = propertyName;
this.ErrorMessage = errorMessage;
this.Object = onObject;
this.ErrorType = errorType;
}
开发者ID:karthikeyanar,项目名称:wvcnet,代码行数:7,代码来源:ErrorInfo.cs
示例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;
}
开发者ID:HaKDMoDz,项目名称:InVision,代码行数:14,代码来源:OISException.cs
示例11: CodeError
public CodeError(ErrorType Type, ErrorLevel Level, CodeLine Line, string Remarks = "")
{
this.Type = Type;
this.Level = Level;
this.Line = Line;
this.Remarks = Remarks;
}
开发者ID:ninjabyte,项目名称:AncientClawAssembler,代码行数:7,代码来源:CodeError.cs
示例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;
}
开发者ID:savagemat,项目名称:arcgis-diagrammer,代码行数:7,代码来源:Error.cs
示例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");
}
}
开发者ID:mdanz92,项目名称:teco.SkillStore,代码行数:28,代码来源:ErrorPopUpFactory.cs
示例14: Error
public Error(string pMessage, ErrorType type, int lineNr, int linePosition)
: base(pMessage)
{
m_type = type;
m_lineNr = lineNr;
m_linePosition = linePosition;
}
开发者ID:bloomingbridges,项目名称:hxSprak,代码行数:7,代码来源:Error.cs
示例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);
}
开发者ID:bmperdue,项目名称:Newtonsoft.Json.Schema,代码行数:26,代码来源:Validator.cs
示例16: showErrorMessage
private void showErrorMessage(ErrorType error)
{
GameObject msgBox = null; // Set to null to avoid errors on compilation time
string dialogName = null;
switch (error)
{
case ErrorType.CIVILIZATION_MISSING:
msgBox = (GameObject) Instantiate(prefabs[0]);
msgBox.name = ERROR_DIALOG_CIVILIZATION;
dialogName = ERROR_DIALOG_CIVILIZATION;
break;
case ErrorType.GAME_MODE_MISSING:
msgBox = (GameObject) Instantiate(prefabs[1]);
msgBox.name = ERROR_DIALOG_GAME_MODE;
dialogName = ERROR_DIALOG_GAME_MODE;
break;
case ErrorType.SKILL_MISSING:
msgBox = (GameObject) Instantiate(prefabs[2]);
msgBox.name = ERROR_DIALOG_SKILL;
dialogName = ERROR_DIALOG_SKILL;
break;
}
msgBox.GetComponentInChildren<Button>().onClick.AddListener(() => {
GameObject obj = GameObject.Find(dialogName);
Destroy(obj);
});
}
开发者ID:srferran,项目名称:ES2015A,代码行数:27,代码来源:GameSetupScript.cs
示例17: RaiseError
public override void RaiseError(string message, ErrorType errorType, JSchema schema, object value, IList<ValidationError> childErrors)
{
if (Errors == null)
Errors = new List<ValidationError>();
Errors.Add(Validator.CreateError(message, errorType, schema, value, childErrors));
}
开发者ID:Nangal,项目名称:Newtonsoft.Json.Schema,代码行数:7,代码来源:ConditionalContext.cs
示例18: FastConstants
static FastConstants()
{
ANY_TYPE = new QName("any");
ERROR = FastAlertSeverity.ERROR;
WARN = FastAlertSeverity.WARN;
FATAL = FastAlertSeverity.FATAL;
DYNAMIC = new ErrorType("Dynamic");
STATIC = new ErrorType("Static");
REPORTABLE = new ErrorType("Reportable");
S1_INVALID_XML = new ErrorCode(STATIC, 1, "ERR S1", "Invalid XML", ERROR);
S2_OPERATOR_TYPE_INCOMP = new ErrorCode(STATIC, 2, "ERR S2", "Incompatible operator and type", ERROR);
S3_INITIAL_VALUE_INCOMP = new ErrorCode(STATIC, 3, "ERR S3", "Incompatible initial value", ERROR);
S4_NO_INITIAL_VALUE_FOR_CONST = new ErrorCode(STATIC, 4, "ERR S4", "Fields with constant operators must have a default value defined.", ERROR);
S5_NO_INITVAL_MNDTRY_DFALT = new ErrorCode(STATIC, 5, "ERR S5", "No initial value for mandatory field with default operator", ERROR);
D1_FIELD_APP_INCOMP = new ErrorCode(DYNAMIC, 1, "ERR D1", "Field cannot be converted to type of application field", ERROR);
D2_INT_OUT_OF_RANGE = new ErrorCode(DYNAMIC, 2, "ERR D2", "The integer value is out of range for the specified integer type.", WARN);
D3_CANT_ENCODE_VALUE = new ErrorCode(DYNAMIC, 3, "ERR D3", "The value cannot be encoded for the given operator.", ERROR);
D4_INVALID_TYPE = new ErrorCode(DYNAMIC, 4, "ERR D4", "The previous value is not the same type as the type of the current field.", ERROR);
D5_NO_DEFAULT_VALUE = new ErrorCode(DYNAMIC, 5, "ERR D5", "If no prior value is set and the field is not present, there must be a default value or the optional flag must be set.", ERROR);
D6_MNDTRY_FIELD_NOT_PRESENT = new ErrorCode(DYNAMIC, 6, "ERR D6", "A mandatory field must have a value", ERROR);
D7_SUBTRCTN_LEN_LONG = new ErrorCode(DYNAMIC, 7, "ERR D7", "The subtraction length is longer than the base value.", ERROR);
D8_TEMPLATE_NOT_EXIST = new ErrorCode(DYNAMIC, 8, "ERR D8", "The referenced template does not exist.", ERROR);
D9_TEMPLATE_NOT_REGISTERED = new ErrorCode(DYNAMIC, 9, "ERR D9", "The template has not been registered.", ERROR);
R1_LARGE_DECIMAL = new ErrorCode(REPORTABLE, 1, "ERR R1", "Decimal exponent does not fit into range -63...63", WARN);
R4_NUMERIC_VALUE_TOO_LARGE = new ErrorCode(REPORTABLE, 4, "ERR R4", "The value is too large.", WARN);
R5_DECIMAL_CANT_CONVERT_TO_INT = new ErrorCode(REPORTABLE, 5, "ERR R5", "The decimal value cannot convert to an integer because of trailing decimal part.", WARN);
R7_PMAP_OVERLONG = new ErrorCode(REPORTABLE, 7, "ERR R7", "The presence map is overlong.", WARN);
R8_PMAP_TOO_MANY_BITS = new ErrorCode(REPORTABLE, 8, "ERR R8", "The presence map has too many bits.", WARN);
R9_STRING_OVERLONG = new ErrorCode(REPORTABLE, 9, "ERR R9", "The string is overlong.", ERROR);
GENERAL_ERROR = new ErrorCode(DYNAMIC, 100, "GENERAL", "An error has occurred.", ERROR);
IMPOSSIBLE_EXCEPTION = new ErrorCode(DYNAMIC, 101, "IMPOSSIBLE", "This should never happen.", ERROR);
IO_ERROR = new ErrorCode(DYNAMIC, 102, "IOERROR", "An IO error occurred.", FATAL);
PARSE_ERROR = new ErrorCode(DYNAMIC, 103, "PARSEERR", "An exception occurred while parsing.", ERROR);
LENGTH_FIELD = new QName("length", TEMPLATE_DEFINITION_1_1);
}
开发者ID:marlonbomfim,项目名称:openfastdotnet,代码行数:35,代码来源:FastConstants.cs
示例19: Start
public async void Start()
{
try
{
error = await Open();
if (error != null)
{
errorType = ErrorType.Open;
}
}
catch (Exception e)
{
log.LogError("Got exception opening stream " + e.ToString());
error = e.Message;
errorType = ErrorType.Open;
}
log.LogInformation("About to await writes");
await WriteAll();
log.LogInformation("Writes done: setting finish");
finished.RunSynchronously();
}
开发者ID:knowledgehacker,项目名称:Dryad,代码行数:25,代码来源:StreamWriter.cs
示例20: MessageItem
public MessageItem(ErrorType ErrorType, ValidatorType ValidatorType, string Message)
{
this.ErrorType = ErrorType;
this.ValidatorType = ValidatorType;
this.Message = Message;
Fields = new List<string>();
}
开发者ID:jungfengpaulwang,项目名称:EMBAValidator,代码行数:7,代码来源:MessageItem.cs
注:本文中的ErrorType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论