当前位置: 首页>>代码示例>>C#>>正文


C# ErrorType类代码示例

本文整理汇总了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));
        }
开发者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


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