Пример #1
0
        internal static RuntimeException NewInterpreterExceptionByMessage(
            Type exceptionType,
            Token errToken,
            string message,
            string errorId,
            Exception innerException)
        {
            RuntimeException runtimeException;

            if (exceptionType == typeof(ParseException))
            {
                runtimeException = (RuntimeException) new ParseException(message, errorId, innerException);
            }
            else if (exceptionType == typeof(IncompleteParseException))
            {
                runtimeException = errToken == null || !errToken.EndOfInput() || !string.IsNullOrEmpty(errToken.File) ? (RuntimeException) new ParseException(message, errorId, innerException) : (RuntimeException) new IncompleteParseException(message, errorId, innerException);
            }
            else
            {
                runtimeException = new RuntimeException(message, innerException);
                runtimeException.SetErrorId(errorId);
                runtimeException.SetErrorCategory(ErrorCategory.InvalidOperation);
            }
            if (errToken != null)
            {
                runtimeException.ErrorRecord.SetInvocationInfo(new InvocationInfo((CommandInfo)null, errToken));
            }
            InterpreterError.tracer.TraceException((Exception)runtimeException);
            return(runtimeException);
        }
Пример #2
0
 internal static RuntimeException NewInterpreterExceptionByMessage(Type exceptionType, IScriptExtent errorPosition, string message, string errorId, Exception innerException)
 {
     RuntimeException exception;
     if (exceptionType == typeof(ParseException))
     {
         exception = new ParseException(message, errorId, innerException);
     }
     else if (exceptionType == typeof(IncompleteParseException))
     {
         exception = new IncompleteParseException(message, errorId, innerException);
     }
     else
     {
         exception = new RuntimeException(message, innerException);
         exception.SetErrorId(errorId);
         exception.SetErrorCategory(ErrorCategory.InvalidOperation);
     }
     if (errorPosition != null)
     {
         exception.ErrorRecord.SetInvocationInfo(new InvocationInfo(null, errorPosition));
     }
     return exception;
 }
Пример #3
0
        internal static RuntimeException NewInterpreterExceptionByMessage(Type exceptionType, IScriptExtent errorPosition, string message, string errorId, Exception innerException)
        {
            RuntimeException exception;

            if (exceptionType == typeof(ParseException))
            {
                exception = new ParseException(message, errorId, innerException);
            }
            else if (exceptionType == typeof(IncompleteParseException))
            {
                exception = new IncompleteParseException(message, errorId, innerException);
            }
            else
            {
                exception = new RuntimeException(message, innerException);
                exception.SetErrorId(errorId);
                exception.SetErrorCategory(ErrorCategory.InvalidOperation);
            }
            if (errorPosition != null)
            {
                exception.ErrorRecord.SetInvocationInfo(new InvocationInfo(null, errorPosition));
            }
            return(exception);
        }