private static void PrintValidationMessage(ValidationError error, ILog log, int tabs = 0)
            {
                string tabString = tabs != 0
                    ? String.Concat(Enumerable.Repeat("\t", tabs))
                    : "";

                log.Error("{0}({1},{2}):{3}", tabString, error.LineNumber, error.LinePosition, error.Message);
                error.ChildErrors.ToList().ForEach(p => PrintValidationMessage(p, log, tabs + 1));
            }
 /// <summary>
 /// Initializes a new instance of the <see cref="JSchemaValidationException"/> class
 /// with a specified error message and a reference to the inner exception that is the cause of this exception.
 /// </summary>
 /// <param name="message">The error message that explains the reason for the exception.</param>
 /// <param name="innerException">The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.</param>
 /// <param name="validationError">The <see cref="ValidationError"/> for ths exception.</param>
 public JSchemaValidationException(string message, Exception innerException, ValidationError validationError)
     : base(message, innerException)
 {
     ValidationError = validationError;
 }
 internal static ValidationError CreateValidationError(IFormattable message, ErrorType errorType, JSchema schema, Uri schemaId, object value, IList<ValidationError> childErrors, IJsonLineInfo lineInfo, string path)
 {
     ValidationError error = new ValidationError();
     error._formattable = message;
     error.ErrorType = errorType;
     error.Path = path;
     if (lineInfo != null)
     {
         error.LineNumber = lineInfo.LineNumber;
         error.LinePosition = lineInfo.LinePosition;
     }
     error.Schema = schema;
     error.SchemaId = schemaId;
     error.SchemaBaseUri = schema.BaseUri;
     error.Value = value;
     error.ChildErrors = childErrors;
     return error;
 }
 internal SchemaValidationEventArgs(ValidationError validationError)
 {
     ValidationUtils.ArgumentNotNull(validationError, "validationError");
     _validationError = validationError;
     _message = validationError.BuildExtendedMessage();
 }
        internal static JSchemaValidationException Create(ValidationError validationError)
        {
            JSchemaValidationException ex = new JSchemaValidationException(validationError.BuildExtendedMessage(), null, validationError);

            return ex;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="JSchemaException"/> class
 /// with a specified error message and a reference to the inner exception that is the cause of this exception.
 /// </summary>
 /// <param name="message">The error message that explains the reason for the exception.</param>
 /// <param name="innerException">The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.</param>
 /// <param name="validationError">The <see cref="ValidationError"/> for ths exception.</param>
 public JSchemaException(string message, Exception innerException, ValidationError validationError)
     : base(message, innerException)
 {
     ValidationError = validationError;
 }
        internal static JSchemaException Create(string message, ValidationError validationError)
        {
            JSchemaException ex = new JSchemaException(validationError.BuildExtendedMessage(), null, validationError);

            return(ex);
        }
        internal static JSchemaValidationException Create(ValidationError validationError)
        {
            JSchemaValidationException ex = new JSchemaValidationException(validationError.GetExtendedMessage(), null, validationError);

            return(ex);
        }
 internal SchemaValidationEventArgs(ValidationError validationError)
 {
     ValidationUtils.ArgumentNotNull(validationError, "validationError");
     _validationError = validationError;
     _message         = validationError.BuildExtendedMessage();
 }
Beispiel #10
0
 internal SchemaValidationEventArgs(ValidationError validationError)
 {
     ValidationUtils.ArgumentNotNull(validationError, nameof(validationError));
     _validationError = validationError;
 }