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
: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

View File

@ -23,6 +23,7 @@
#include <algorithm>
#include <iterator>
#include <list>
#include <cerrno>
#include "sqlite.hpp"
#include "remwharead_cli.hpp"
#include "uri.hpp"
@ -59,7 +60,7 @@ int App::main(const std::vector<std::string> &args)
{
if (_argument_error)
{
return Application::EXIT_USAGE;
return EINVAL;
}
if (args.size() > 0)
{
@ -68,15 +69,15 @@ int App::main(const std::vector<std::string> &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<std::string> &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<std::string> &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<std::string> &args)
}
}
return Application::EXIT_OK;
return 0;
}
POCO_APP_MAIN(App)