Catch JSON errors.
This commit is contained in:
parent
bad3059092
commit
2a0fd3d6e4
|
@ -2,7 +2,7 @@
|
||||||
:doctype: manpage
|
:doctype: manpage
|
||||||
:Author: tastytea
|
:Author: tastytea
|
||||||
:Email: tastytea@tastytea.de
|
:Email: tastytea@tastytea.de
|
||||||
:Date: 2019-12-25
|
:Date: 2019-12-28
|
||||||
:Revision: 0.0.0
|
:Revision: 0.0.0
|
||||||
:man source: mastorss
|
:man source: mastorss
|
||||||
:man manual: General Commands Manual
|
:man manual: General Commands Manual
|
||||||
|
@ -157,15 +157,16 @@ proxy support yet, sorry.
|
||||||
== ERROR CODES
|
== ERROR CODES
|
||||||
|
|
||||||
[cols=">,<"]
|
[cols=">,<"]
|
||||||
|===========================================================
|
|===============================================================================
|
||||||
| Code | Explanation
|
| Code | Explanation
|
||||||
|
|
||||||
| 1 | No profile specified.
|
| 1 | No profile specified.
|
||||||
| 2 | Network error.
|
| 2 | Network error.
|
||||||
| 3 | File error.
|
| 3 | File error.
|
||||||
| 4 | Mastodon API error.
|
| 4 | Mastodon API error.
|
||||||
|
| 5 | JSON error, most likely the file is wrongly formatted.
|
||||||
| 9 | Unknown error.
|
| 9 | Unknown error.
|
||||||
|===========================================================
|
|===============================================================================
|
||||||
|
|
||||||
== DEBUGGING
|
== DEBUGGING
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ constexpr int noprofile = 1;
|
||||||
constexpr int network = 2;
|
constexpr int network = 2;
|
||||||
constexpr int file = 3;
|
constexpr int file = 3;
|
||||||
constexpr int mastodon = 4;
|
constexpr int mastodon = 4;
|
||||||
|
constexpr int json = 5;
|
||||||
constexpr int unknown = 9;
|
constexpr int unknown = 9;
|
||||||
} // namespace error
|
} // namespace error
|
||||||
|
|
||||||
|
@ -134,6 +135,11 @@ int main(int argc, char *argv[])
|
||||||
cerr << e.what() << '\n';
|
cerr << e.what() << '\n';
|
||||||
return error::network;
|
return error::network;
|
||||||
}
|
}
|
||||||
|
catch (const Json::RuntimeError &e)
|
||||||
|
{
|
||||||
|
cerr << "JSON error:\n" << e.what() << '\n';
|
||||||
|
return error::json;
|
||||||
|
}
|
||||||
catch (const runtime_error &e)
|
catch (const runtime_error &e)
|
||||||
{
|
{
|
||||||
cerr << e.what() << '\n';
|
cerr << e.what() << '\n';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user