コード例 #1
0
 private void OnValidationEvent(JsonSchemaException exception)
 {
     ValidationEventHandler handler = ValidationEventHandler;
     if (handler != null)
         handler(this, new ValidationEventArgs(exception));
     else
         throw exception;
 }
コード例 #2
0
 private void OnValidationEvent(JsonSchemaException exception)
 {
     Newtonsoft.Json.Schema.ValidationEventHandler validationEventHandler = this.ValidationEventHandler;
     if (validationEventHandler == null)
     {
         throw exception;
     }
     validationEventHandler((object)this, new ValidationEventArgs(exception));
 }
コード例 #3
0
 private void method_17(JsonSchemaException jsonSchemaException_0)
 {
     Newtonsoft.Json.Schema.ValidationEventHandler handler = this.validationEventHandler_0;
     if (handler == null)
     {
         throw jsonSchemaException_0;
     }
     handler(this, new ValidationEventArgs(jsonSchemaException_0));
 }
コード例 #4
0
        private void OnValidationEvent(JsonSchemaException exception)
        {
            ValidationEventHandler validationEventHandler = this.ValidationEventHandler;

            if (validationEventHandler == null)
            {
                throw exception;
            }
            validationEventHandler(this, new ValidationEventArgs(exception));
        }
コード例 #5
0
        public void JsonSchemaException()
        {
            JsonSchemaException exception = new JsonSchemaException();

            Assert.AreEqual("Exception of type 'BESSy.Json.Schema.JsonSchemaException' was thrown.", exception.Message);

            exception = new JsonSchemaException("Message!");
            Assert.AreEqual("Message!", exception.Message);
            Assert.AreEqual(null, exception.InnerException);

            exception = new JsonSchemaException("Message!", new Exception("Inner!"));
            Assert.AreEqual("Message!", exception.Message);
            Assert.AreEqual("Inner!", exception.InnerException.Message);
        }
コード例 #6
0
        private void RaiseError(string message, SchemaReport report)
        {
            IJsonLineInfo lineInfo = this;

            string exceptionMessage = (lineInfo.HasLineInfo())
                ? message + " Line {0}, position {1}.".FormatWith(CultureInfo.InvariantCulture, lineInfo.LineNumber, lineInfo.LinePosition)
                : message;

            JsonSchemaException ex = new JsonSchemaException(exceptionMessage, null, Path, lineInfo.LineNumber, lineInfo.LinePosition);

            if (report != null && report.Messages != null)
                report.Messages.Add(ex);
            else
                OnValidationEvent(ex);
        }