diff options
author | Alex Dowad <alexinbeijing@gmail.com> | 2015-04-22 08:40:03 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2015-04-22 20:08:16 +0300 |
commit | 74dc8e232f1637c8fc1eaed4e5c1cd7ac946f049 (patch) | |
tree | eb54a7746ee7c86d83fdd22e9e90d5cf38efc575 /src/print.c | |
parent | be31eb24d8724b65929d0b5a9d037cde565c9dfe (diff) | |
download | apk-tools-74dc8e232f1637c8fc1eaed4e5c1cd7ac946f049.tar.gz apk-tools-74dc8e232f1637c8fc1eaed4e5c1cd7ac946f049.tar.bz2 apk-tools-74dc8e232f1637c8fc1eaed4e5c1cd7ac946f049.tar.xz apk-tools-74dc8e232f1637c8fc1eaed4e5c1cd7ac946f049.zip |
print.c: provide more detailed error messages if retrieving a package fails
fetch_maperror() translates error codes returned by libfetch to our error
codes. Handle those in apk_error_str(), returning error messages which
advise the user of the most likely fix.
A custom error code, EAPKSTALEINDEX, has been added for cases where
retrieving a package fails due to a HTTP error 404 or similar.
[TimoT: add also EAPKBADURL, as well as organize a bit better where the
EAPKSTALEINDEX is generated]
Diffstat (limited to 'src/print.c')
-rw-r--r-- | src/print.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/print.c b/src/print.c index d8b0f3f..e0681ee 100644 --- a/src/print.c +++ b/src/print.c @@ -133,7 +133,25 @@ const char *apk_error_str(int error) case ENOMSG: return "archive does not contain expected data"; case ENOPKG: - return "package not available"; + return "could not find a repo which provides this package (check repositories file and run 'apk update')"; + case ECONNABORTED: + return "network connection aborted"; + case ECONNREFUSED: + return "could not connect to server (check repositories file)"; + case ENETUNREACH: + return "network error (check Internet connection and firewall)"; + case ENXIO: + return "DNS lookup error"; + case EREMOTEIO: + return "error code returned by repo server (try 'apk update')"; + case ETIMEDOUT: + return "operation timed out"; + case EAGAIN: + return "temporary error (try again later)"; + case EINVAL: + return "invalid URL (check your repositories file)"; + case EAPKSTALEINDEX: + return "file not available from repo server (try 'apk update')"; default: return strerror(error); } |