예제 #1
0
        /// <summary>
        /// Creates an instance of an error. 
        /// </summary>
        /// <remarks>
        /// Creates an inner error object.
        /// </remarks>
        /// <param name="generalMessage">
        /// The general error message to associate with the error.
        /// </param>
        /// <param name="innerMessage">
        /// Describes the inner error message to assoxiate with the inner error.
        /// </param>
        /// <param name="severity">
        /// The severity of the error.
        /// </param>
        /// <param name="category">
        /// The category of the error.
        /// </param>
        /// <param name="errorType">
        /// The type of the error.
        /// </param>
        /// <returns>
        /// A new instance of the error.
        /// </returns>
        public static Error CreateError(string generalMessage, string innerMessage, Severity severity, ErrorCategory category, ErrorType errorType)
        {
            var error = new Error();
            error.ErrorMessage = generalMessage;
            error.Category = ErrorCategory.Application;
            error.ErrorType = ErrorType.Validation;
            error.SeverityLevel = Severity.Error;

            error.InnerErrors.Add(InnerError.CreateError(innerMessage, severity, category, errorType));

            return error;
        }    
예제 #2
0
        /// <summary>
        /// Creates an instance of an error. 
        /// </summary>
        /// <remarks>
        /// Does not create any inner error objects.
        /// </remarks>
        /// <param name="generalMessage">
        /// The general error message to associate with the error.
        /// </param>
        /// <param name="severity">
        /// The severity of the error.
        /// </param>
        /// <param name="category">
        /// The category of the error.
        /// </param>
        /// <param name="errorType">
        /// The type of the error.
        /// </param>
        /// <returns>
        /// A new instance of the error.
        /// </returns>
        public static Error CreateError(string generalMessage, Severity severity, ErrorCategory category, ErrorType errorType)
        {
            var error = new Error();
            error.ErrorMessage = generalMessage;
            error.Category = category;
            error.ErrorType = errorType;
            error.SeverityLevel = severity;          

            return error;
        }