public ErrorMatch(ErrorSeverity Severity, ErrorPriority Priority, string Type, int MinLineNumber, int MaxLineNumber)
 {
     this.Severity      = Severity;
     this.Priority      = Priority;
     this.Type          = Type;
     this.MinLineNumber = MinLineNumber;
     this.MaxLineNumber = MaxLineNumber;
 }
 public ErrorMatch(ErrorSeverity Severity, ErrorPriority Priority, string Type, ReadOnlyLineBuffer Input, int MinOffset, int MaxOffset)
     : this(Severity, Priority, Type, Input.CurrentLineNumber + MinOffset, Input.CurrentLineNumber + MaxOffset)
 {
     for (int Offset = MinOffset; Offset <= MaxOffset; Offset++)
     {
         Lines.Add(Input[Offset]);
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Throws the error.
        /// </summary>
        /// <param name="error">Error.</param>
        /// <param name="priority">Priority.</param>
        public static void ThrowError(ErrorCode error, ErrorPriority priority)
        {
            // Create a string to display as error message.
            string message = string.Empty;

            // Append text based on ErrorCode.
            switch (error)
            {
#if UNITY_EDITOR
            case ErrorCode.NullError:
                message = "ErrorCode.NullError should only be used for testing!";
                break;
#endif
            case ErrorCode.UnassignedVariable:
                message = "Unassigned Variable: A variable has not been assigned.";
                break;

            case ErrorCode.MissingComponent:
                message = "Missing Component: A component you are trying to access is not present.";
                break;

            default:
                message = "ErrorCode Error: No ErrorCode specified.";
                break;
            }

            // Throw the appropriate error based on ErrorPriority.
            switch ((int)priority)
            {
            case 1:
                Debug.Log(message);
                break;

            case 2:
                Debug.LogWarning(message);
                break;

            case 4:
                Debug.LogError(message);
                break;

            default:
                message += "(No ErrorPriority specified!)";
                Debug.Log(message);
                break;
            }
        }
Esempio n. 4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="innerException"></param>
 /// <param name="errorCode"></param>
 /// <param name="priority"></param>
 /// <param name="messageProvider"></param>
 public PxException(Exception innerException, string errorCode, ErrorPriority priority, IPxErrorMessageProvider messageProvider) : base(null, innerException)
 {
     this.messageProvider = messageProvider;
     ErrorCode            = errorCode;
     if (innerException == null)
     {
         this.Priority = priority;
     }
     else if (innerException is PxException)
     {
         PxException ex = innerException as PxException;
         this.Priority = ex.Priority;
     }
     else
     {
         this.Priority = ErrorPriority.High;
     }
 }
 /// <summary>
 /// Standard Constructor
 /// </summary>
 public ErrorRecord(string fileName        = null,
                    string description     = null,
                    string errorCategory   = null,
                    int errorCode          = 0,
                    ErrorSeverity severity = ErrorSeverity.Major,
                    ErrorPriority priority = ErrorPriority.Medium,
                    int line   = -1,
                    int column = -1)
 {
     FileName      = fileName?.Trim() ?? "";
     Description   = description?.Trim() ?? "";
     ErrorCategory = (errorCategory ?? "").Trim().PadRight(3, '_').Substring(0, 3).ToUpperInvariant();
     ErrorCode     = errorCode < 0 ? 0 : errorCode;
     Severity      = severity;
     Priority      = priority;
     Line          = line < 0 ? -1 : line;
     Column        = column < 0 ? -1 : column;
 }
Esempio n. 6
0
        public static void LogError(string userError, ErrorArea area, ErrorPriority priority, bool userNotified, Exception ex)
        {
            string methodName  = new StackFrame(1, true).GetMethod().Name;
            string errPriority = string.Empty;

            errPriority = GetDescription <ErrorPriority>(priority);

            string errArea = string.Empty;

            errArea = GetDescription <ErrorArea>(area);

            StringBuilder sb = new StringBuilder();

            if (ex != null)
            {
                sb.Append(string.Format("Error Message: {0} ", ex.Message));
                if (ex.InnerException != null)
                {
                    sb.Append(string.Format("Inner Exception: {0} ", ex.InnerException));
                }
                sb.Append(string.Format("Stack Trace: {0}", ex.StackTrace));
            }
        }
 public ErrorMatch(ErrorSeverity Severity, ErrorPriority Priority, string Type, ReadOnlyLineBuffer Input)
     : this(Severity, Priority, Type, Input, 0, 0)
 {
 }
Esempio n. 8
0
 public PxException(Exception innerException, string errorCode, ErrorPriority priority, string errorMessage) : base(errorMessage, innerException)
 {
     ErrorCode     = errorCode;
     this.Priority = priority;
     _message      = errorMessage;
 }
Esempio n. 9
0
 public PxException(string errorCode, ErrorPriority priority, string errorMessage)
 {
     ErrorCode     = errorCode;
     this.Priority = priority;
     _message      = errorMessage;
 }
Esempio n. 10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="errorCode"></param>
 /// <param name="priority"></param>
 /// <param name="messageProvider"></param>
 public PxException(string errorCode, ErrorPriority priority, IPxErrorMessageProvider messageProvider) : this(null, errorCode, priority, messageProvider)
 {
 }
Esempio n. 11
0
 /// <summary>
 ///     Configuration constructor for enum
 /// </summary>
 /// <param name="description">Error description</param>
 /// <param name="priority">Error priority</param>
 /// <param name="source">Error source</param>
 public Configuration(string description, ErrorPriority priority, ErrorSource source)
 {
     _description = description;
     _priority    = priority;
     _source      = source;
 }