-Added Path to JsonReaderException, JsonSchemaException and ValidationEventArgs

-Fixed Path on JsonValidatingReader
-Fixed path queries over constructors
This commit is contained in:
James Newton-King
2012-02-25 16:44:07 +13:00
parent 0d6ad0b76e
commit fb2a5998bc
14 changed files with 142 additions and 47 deletions
@@ -49,6 +49,12 @@ namespace Newtonsoft.Json.Schema
/// <value>The line position indicating where the error occurred.</value>
public int LinePosition { get; private set; }
/// <summary>
/// Gets the path to the JSON where the error occurred.
/// </summary>
/// <value>The path to the JSON where the error occurred.</value>
public string Path { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="JsonSchemaException"/> class.
/// </summary>
@@ -91,9 +97,10 @@ namespace Newtonsoft.Json.Schema
}
#endif
internal JsonSchemaException(string message, Exception innerException, int lineNumber, int linePosition)
internal JsonSchemaException(string message, Exception innerException, string path, int lineNumber, int linePosition)
: base(message, innerException)
{
Path = path;
LineNumber = lineNumber;
LinePosition = linePosition;
}
@@ -42,16 +42,25 @@ namespace Newtonsoft.Json.Schema
}
/// <summary>
/// Gets the <see cref="JsonSchemaException"/> associated with the validation event.
/// Gets the <see cref="JsonSchemaException"/> associated with the validation error.
/// </summary>
/// <value>The JsonSchemaException associated with the validation event.</value>
/// <value>The JsonSchemaException associated with the validation error.</value>
public JsonSchemaException Exception
{
get { return _ex; }
}
/// <summary>
/// Gets the text description corresponding to the validation event.
/// Gets the path of the JSON location where the validation error occurred.
/// </summary>
/// <value>The path of the JSON location where the validation error occurred.</value>
public string Path
{
get { return _ex.Path; }
}
/// <summary>
/// Gets the text description corresponding to the validation error.
/// </summary>
/// <value>The text description.</value>
public string Message