示例#1
0
 public static StatementContext <T> Error(
     [CanBeNull] string statement,
     ContextErrorNumber errorNumber,
     [NotNull] string errorMessage)
 {
     return(new StatementContext <T>(statement, errorNumber, errorMessage));
 }
示例#2
0
 public static ProgramContext <T> Error(
     [CanBeNull] Program program,
     ContextErrorNumber errorNumber,
     [NotNull] string errorMessage)
 {
     return(new ProgramContext <T>(program, errorNumber, errorMessage));
 }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StatementContext{T}"/> class.
        /// </summary>
        /// <param name="statement">The statement that was evaluated</param>
        /// <param name="errorNumber">The general category of error that occurred</param>
        /// <param name="errorMessage">The specific error message that was recorded</param>
        /// <exception cref="ArgumentNullException">Thrown when a null error message is supplied to this constructor</exception>
        private StatementContext([CanBeNull] string statement, ContextErrorNumber errorNumber, [NotNull] string errorMessage)
            : base(errorNumber, errorMessage)
        {
            if (string.IsNullOrWhiteSpace(errorMessage))
            {
                throw new ArgumentNullException(nameof(errorMessage));
            }

            this.statement = statement;
        }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProgramContext{T}"/> class.
        /// </summary>
        /// <param name="program">The program that was executed</param>
        /// <param name="errorNumber">The general category of error that occurred</param>
        /// <param name="errorMessage">The specific error message that was recorded</param>
        /// <exception cref="ArgumentNullException">Thrown when a null error message is supplied to this constructor</exception>
        private ProgramContext([CanBeNull] Program program, ContextErrorNumber errorNumber, [NotNull] string errorMessage)
            : base(errorNumber, errorMessage)
        {
            if (string.IsNullOrWhiteSpace(errorMessage))
            {
                throw new ArgumentNullException(nameof(errorMessage));
            }

            this.program = program;
        }
示例#5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Context{T}"/> class.
        /// </summary>
        /// <param name="errorNumber">The general category of error that occurred</param>
        /// <param name="errorMessage">The specific error message that was recorded</param>
        /// <exception cref="ArgumentNullException">Thrown when a null error message is supplied to this constructor</exception>
        protected Context(ContextErrorNumber errorNumber, [NotNull] string errorMessage)
        {
            if (string.IsNullOrWhiteSpace(errorMessage))
            {
                throw new ArgumentNullException(nameof(errorMessage));
            }

            this.ErrorNumber  = errorNumber;
            this.ErrorMessage = errorMessage;
            this.State        = ContextState.Errored;
        }