diff --git a/README.md b/README.md index 943ad82..786652f 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,7 @@ After you did a `make install`, a project consisting of one file can be compiled | 4 | Aborted by user | | 10 | Failed to connect | | 11 | Couldn't resolve host | +| 12 | Network is unreachable | | 100 - 999 | HTTP status codes | | 65535 | Unknown error | diff --git a/src/http_sync.cpp b/src/http_sync.cpp index 2c886c7..356fb17 100644 --- a/src/http_sync.cpp +++ b/src/http_sync.cpp @@ -151,6 +151,11 @@ const std::uint16_t API::http::request_sync(const method &meth, { ret = 11; } + else if (std::strncmp(e.what(), + "Network is unreachable", 22) == 0) + { + ret = 12; + } else { cerr << "RUNTIME ERROR: " << e.what() << std::endl; diff --git a/src/mastodon-cpp.hpp b/src/mastodon-cpp.hpp index 2e9a82d..9b8e911 100644 --- a/src/mastodon-cpp.hpp +++ b/src/mastodon-cpp.hpp @@ -49,8 +49,9 @@ namespace Mastodon * | 2 | Not implemented | * | 3 | URL changed (HTTP 301 or 308) | * | 4 | Aborted by user | -* | 10 | Failed to connect | -* | 11 | Couldn't resolve host | + * | 10 | Failed to connect | + * | 11 | Couldn't resolve host | + * | 12 | Network is unreachable | * | 100 - 999 | HTTP status codes | * | 65535 | Unknown exception | */