Error Details

Example

Missing closing braces error

Consider Example.json below that has unclosed brace in JsonQL expression.

File Example.json

{
  "TestData": [ 1, 3, 4, "5", "TEST", 7 ],
  "ValidFunctionCallExample": "[ToInt(TestData[3]) + 1]==$(ToInt(TestData[3]) + 1)==6",
  "InvalidFunctionCallExample_ClosingBraceMissing": "[ToInt(TestData[3]) + 1]==$(ToInt(TestData[3] + 1)==6"
}

The C# code snippet below loads the file Example.json

// JsonQL.Compilation.IJsonCompile is normally setup in DI and is injected into classes that depend on this interface.
JsonQL.Compilation.IJsonCompile jsonCompiler;
var result = jsonCompiler.Compile(new JsonTextData("Example", this.LoadExampleJsonFile("Example.json")));

The result result is serialized in JSON file Result.json which has the error details.

The screenshot below shows the error details logged using the error data in Result.json.

../../_images/missing-closing-brace-error.jpg

Note

Errors are logged by JsonQL.Compilation.ICompilationResultLogger and custom implementation of this interface can be provided.

Note

For more examples demonstrating errors look at examples in this folder: FailureExamples: