Catch JSON exceptions in nlohmann-json example.
This commit is contained in:
parent
25c75a6211
commit
151103a9a1
|
@ -106,7 +106,6 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
handle_error(answer);
|
handle_error(answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (const masto::CURLException &e)
|
catch (const masto::CURLException &e)
|
||||||
{
|
{
|
||||||
|
@ -114,6 +113,10 @@ int main(int argc, char *argv[])
|
||||||
// There went probably something wrong with the initialization.
|
// There went probably something wrong with the initialization.
|
||||||
cerr << e.what() << '\n';
|
cerr << e.what() << '\n';
|
||||||
}
|
}
|
||||||
|
catch (const nlohmann::detail::exception &e)
|
||||||
|
{
|
||||||
|
cerr << "JSON exception: " << e.what() << '\n';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_error(const masto::answer_type &answer)
|
void handle_error(const masto::answer_type &answer)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user