Added errors: SSL, timeout
This commit is contained in:
parent
af08c4e419
commit
a7b714259b
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required (VERSION 3.7)
|
||||
project (mastodon-cpp
|
||||
VERSION 0.8.5
|
||||
VERSION 0.8.6
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
|
|
|
@ -79,6 +79,8 @@ mastodon-cpp will never use error codes below 11, except 0.
|
|||
| 21 | Couldn't resolve host |
|
||||
| 22 | Network is unreachable |
|
||||
| 23 | Transfer interrupted |
|
||||
| 24 | SSL error |
|
||||
| 25 | Timeout |
|
||||
| 100 - 999 | HTTP status codes |
|
||||
| 65535 | Unknown error |
|
||||
|
||||
|
|
11
src/http.cpp
11
src/http.cpp
|
@ -136,6 +136,7 @@ const uint_fast16_t API::http::request(const method &meth,
|
|||
}
|
||||
catch (curlpp::RuntimeError &e)
|
||||
{
|
||||
// FIXME: There has to be a better way
|
||||
if (std::strncmp(e.what(),
|
||||
"Failed writing body", 19) == 0)
|
||||
{
|
||||
|
@ -164,6 +165,16 @@ const uint_fast16_t API::http::request(const method &meth,
|
|||
{
|
||||
ret = 23;
|
||||
}
|
||||
else if (std::strncmp(e.what(),
|
||||
"OpenSSL SSL_read: SSL_ERROR_SYSCALL", 35) == 0)
|
||||
{
|
||||
ret = 24;
|
||||
}
|
||||
else if (std::strncmp(e.what(),
|
||||
"Operation timed out", 19) == 0)
|
||||
{
|
||||
ret = 25;
|
||||
}
|
||||
else
|
||||
{
|
||||
cerr << "RUNTIME ERROR: " << e.what() << std::endl;
|
||||
|
|
|
@ -68,6 +68,8 @@ namespace Mastodon
|
|||
* | 21 | Couldn't resolve host |
|
||||
* | 22 | Network is unreachable |
|
||||
* | 23 | Transfer interrupted |
|
||||
* | 24 | SSL error |
|
||||
* | 25 | Timeout |
|
||||
* | 100 - 999 | HTTP status codes |
|
||||
* | 65535 | Unknown exception |
|
||||
*/
|
||||
|
|
Reference in New Issue