mirror of
https://github.com/tristanpenman/valijson.git
synced 2024-12-14 02:57:45 +01:00
Fix README so the code actually throws, when json is invalid
This commit is contained in:
parent
89e37cbf42
commit
45b0f83b5a
@ -57,7 +57,7 @@ Validate a document:
|
||||
Validator validator;
|
||||
RapidJsonAdapter myTargetAdapter(myTargetDoc);
|
||||
if (!validator.validate(mySchema, myTargetAdapter, NULL)) {
|
||||
std::runtime_error("Validation failed.");
|
||||
throw std::runtime_error("Validation failed.");
|
||||
}
|
||||
|
||||
Note that Valijson's `SchemaParser` and `Validator` classes expect you to pass in a `RapidJsonAdapter` rather than a `rapidjson::Document`. This is due to the fact that `SchemaParser` and `Validator` are template classes that can be used with any of the JSON parsers supported by Valijson.
|
||||
|
Loading…
Reference in New Issue
Block a user