Catch JSON exceptions in nlohmann-json example.

This commit is contained in:
tastytea 2020-01-26 05:16:32 +01:00
parent 25c75a6211
commit 151103a9a1
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07

View File

@ -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)