Updated error codes in manpage and corrected bug in example.

This commit is contained in:
tastytea 2019-08-08 20:37:38 +02:00
parent 3bb1c658b6
commit 6225f4815b
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 16 additions and 16 deletions

View File

@ -2,7 +2,7 @@
:doctype: manpage :doctype: manpage
:Author: tastytea :Author: tastytea
:Email: tastytea@tastytea.de :Email: tastytea@tastytea.de
:Date: 2019-08-05 :Date: 2019-08-08
:Revision: 0.0.0 :Revision: 0.0.0
:man source: remwharead :man source: remwharead
:man manual: General Commands Manual :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_ Only export entries between and including _start_ and _end_. _start_ and _end_
are date and time representations according to ISO 8601 are date and time representations according to ISO 8601
(YYYY-MM-DDThh:mm:ss). Time zones are ignored. (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_:: *-s* _expression_, *--search-tags* _expression_::
Search in tags. Format: _tag1 AND tag2 OR tag3_. See _SEARCH EXPRESSIONS_. Case Search in tags. Format: _tag1 AND tag2 OR tag3_. See _SEARCH EXPRESSIONS_. Case
@ -160,13 +160,12 @@ proxy support yet, sorry.
== ERROR CODES == ERROR CODES
[options="header",cols=">,<"] [options="header",cols=">,<"]
|================================================== |===================================================================
| Code | Explanation | Code | Error name | Explanation |
| 1 | Missing options / Argument not understood. | 5 | EIO | File / database could not be opened. |
| 2 | Database connection failed. | 22 | EINVAL | Missing options / Argument not understood. |
| 3 | File could not be opened. | 113 | EHOSTUNREACH | Could not fetch URI. |
| 4 | Could not fetch URI. |===================================================================
|==================================================
== SEE ALSO == SEE ALSO

View File

@ -23,6 +23,7 @@
#include <algorithm> #include <algorithm>
#include <iterator> #include <iterator>
#include <list> #include <list>
#include <cerrno>
#include "sqlite.hpp" #include "sqlite.hpp"
#include "remwharead_cli.hpp" #include "remwharead_cli.hpp"
#include "uri.hpp" #include "uri.hpp"
@ -59,7 +60,7 @@ int App::main(const std::vector<std::string> &args)
{ {
if (_argument_error) if (_argument_error)
{ {
return Application::EXIT_USAGE; return EINVAL;
} }
if (args.size() > 0) if (args.size() > 0)
{ {
@ -68,15 +69,15 @@ int App::main(const std::vector<std::string> &args)
if (_uri.empty() && _format == export_format::undefined) if (_uri.empty() && _format == export_format::undefined)
{ {
cerr << "Error: You have to specify either an URI or --export.\n"; cerr << "Error: You have to specify either an URI or --export.\n";
return Application::EXIT_USAGE; return EINVAL;
} }
} }
Database db; Database db;
if (!db) if (!db)
{ {
cerr << "Error: Database connection failed.\n"; cerr << "Error: Database could not be opened.\n";
return Application::EXIT_IOERR; return EIO;
} }
if (!_uri.empty()) if (!_uri.empty())
@ -87,7 +88,7 @@ int App::main(const std::vector<std::string> &args)
{ {
cerr << "Error: Could not fetch page.\n"; cerr << "Error: Could not fetch page.\n";
cerr << page.error << endl; cerr << page.error << endl;
return Application::EXIT_UNAVAILABLE; return EHOSTUNREACH;
} }
archive_answer archive; archive_answer archive;
if (_archive) if (_archive)
@ -109,7 +110,7 @@ int App::main(const std::vector<std::string> &args)
if (!file.good()) if (!file.good())
{ {
cerr << "Error: Could not open file: " << _file << endl; cerr << "Error: Could not open file: " << _file << endl;
return Application::EXIT_IOERR; return EIO;
} }
} }
@ -240,7 +241,7 @@ int App::main(const std::vector<std::string> &args)
} }
} }
return Application::EXIT_OK; return 0;
} }
POCO_APP_MAIN(App) POCO_APP_MAIN(App)