1
0
mirror of https://github.com/nlohmann/json synced 2024-09-19 14:20:01 +00:00

Updated exception handling to catch const reference in out_of_range (#4331)

Co-authored-by: LeilaSh <leilanagieva81@gmail.com>
This commit is contained in:
Leila Shcheglova 2024-04-09 02:12:32 +07:00 committed by GitHub
parent 16b3d841d5
commit 377c767aa1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -36,7 +36,7 @@ int main()
// try to read from a nonexisting key using string_view
std::cout << object.at("the fast"sv) << '\n';
}
catch (const json::out_of_range)
catch (const json::out_of_range& e)
{
std::cout << "out of range" << '\n';
}