Added errors: SSL, timeout

This commit is contained in:
tastytea 2018-04-09 17:55:11 +02:00
parent af08c4e419
commit a7b714259b
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
4 changed files with 16 additions and 1 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.7)
project (mastodon-cpp
VERSION 0.8.5
VERSION 0.8.6
LANGUAGES CXX
)

View File

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

View File

@ -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;

View File

@ -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 |
*/