From 6225f4815ba9fa38908445e3a70ac1c4aa6a251c Mon Sep 17 00:00:00 2001 From: tastytea Date: Thu, 8 Aug 2019 20:37:38 +0200 Subject: [PATCH] Updated error codes in manpage and corrected bug in example. --- man/remwharead.1.adoc | 17 ++++++++--------- src/cli/main.cpp | 15 ++++++++------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/man/remwharead.1.adoc b/man/remwharead.1.adoc index 940355b..12dc21c 100644 --- a/man/remwharead.1.adoc +++ b/man/remwharead.1.adoc @@ -2,7 +2,7 @@ :doctype: manpage :Author: tastytea :Email: tastytea@tastytea.de -:Date: 2019-08-05 +:Date: 2019-08-08 :Revision: 0.0.0 :man source: remwharead :man manual: General Commands Manual @@ -45,7 +45,7 @@ Save output to _file_. Default is stdout. Only export entries between and including _start_ and _end_. _start_ and _end_ are date and time representations according to ISO 8601 (YYYY-MM-DDThh:mm:ss). Time zones are ignored. -Example: `--span 2019-01-01,2019-02-10T12:30`. +Example: `--time-span 2019-01-01,2019-02-10T12:30`. *-s* _expression_, *--search-tags* _expression_:: Search in tags. Format: _tag1 AND tag2 OR tag3_. See _SEARCH EXPRESSIONS_. Case @@ -160,13 +160,12 @@ proxy support yet, sorry. == ERROR CODES [options="header",cols=">,<"] -|================================================== -| Code | Explanation -| 1 | Missing options / Argument not understood. -| 2 | Database connection failed. -| 3 | File could not be opened. -| 4 | Could not fetch URI. -|================================================== +|=================================================================== +| Code | Error name | Explanation | +| 5 | EIO | File / database could not be opened. | +| 22 | EINVAL | Missing options / Argument not understood. | +| 113 | EHOSTUNREACH | Could not fetch URI. | +|=================================================================== == SEE ALSO diff --git a/src/cli/main.cpp b/src/cli/main.cpp index f38edfd..bd5e8a6 100644 --- a/src/cli/main.cpp +++ b/src/cli/main.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "sqlite.hpp" #include "remwharead_cli.hpp" #include "uri.hpp" @@ -59,7 +60,7 @@ int App::main(const std::vector &args) { if (_argument_error) { - return Application::EXIT_USAGE; + return EINVAL; } if (args.size() > 0) { @@ -68,15 +69,15 @@ int App::main(const std::vector &args) if (_uri.empty() && _format == export_format::undefined) { cerr << "Error: You have to specify either an URI or --export.\n"; - return Application::EXIT_USAGE; + return EINVAL; } } Database db; if (!db) { - cerr << "Error: Database connection failed.\n"; - return Application::EXIT_IOERR; + cerr << "Error: Database could not be opened.\n"; + return EIO; } if (!_uri.empty()) @@ -87,7 +88,7 @@ int App::main(const std::vector &args) { cerr << "Error: Could not fetch page.\n"; cerr << page.error << endl; - return Application::EXIT_UNAVAILABLE; + return EHOSTUNREACH; } archive_answer archive; if (_archive) @@ -109,7 +110,7 @@ int App::main(const std::vector &args) if (!file.good()) { cerr << "Error: Could not open file: " << _file << endl; - return Application::EXIT_IOERR; + return EIO; } } @@ -240,7 +241,7 @@ int App::main(const std::vector &args) } } - return Application::EXIT_OK; + return 0; } POCO_APP_MAIN(App)