📝 more documentation for the new exceptions

This commit is contained in:
Niels Lohmann 2017-03-08 23:30:38 +01:00
parent 1ab580d6e9
commit 0f6b8aa718
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
11 changed files with 89 additions and 23 deletions

View file

@ -32,4 +32,14 @@ int main()
j.at("/array/1"_json_pointer) = 21;
// output the changed array
std::cout << j["array"] << '\n';
// try to use an invalid JSON pointer
try
{
auto ref = j.at("/number/foo"_json_pointer);
}
catch (json::out_of_range& e)
{
std::cout << e.what() << '\n';
}
}