From 69fd5138ee096151cb1f85b16973c2c49744edb4 Mon Sep 17 00:00:00 2001 From: tastytea Date: Mon, 2 Apr 2018 02:29:39 +0200 Subject: [PATCH] added error 23 --- CMakeLists.txt | 2 +- README.md | 1 + src/http.cpp | 5 +++++ src/mastodon-cpp.hpp | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a35eb81..5b323bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.7) project (mastodon-cpp - VERSION 0.7.23 + VERSION 0.7.24 LANGUAGES CXX ) diff --git a/README.md b/README.md index f83241d..9cee5a3 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,7 @@ mastodon-cpp will never use error codes below 11, except 0. | 20 | Failed to connect | | 21 | Couldn't resolve host | | 22 | Network is unreachable | +| 23 | Transfer interrupted | | 100 - 999 | HTTP status codes | | 65535 | Unknown error | diff --git a/src/http.cpp b/src/http.cpp index dce18d3..9af68e5 100644 --- a/src/http.cpp +++ b/src/http.cpp @@ -159,6 +159,11 @@ const uint_fast16_t API::http::request(const method &meth, { ret = 22; } + else if (std::strncmp(e.what(), + "transfer closed with outstanding", 32) == 0) + { + ret = 23; + } else { cerr << "RUNTIME ERROR: " << e.what() << std::endl; diff --git a/src/mastodon-cpp.hpp b/src/mastodon-cpp.hpp index 2a5bca2..534b317 100644 --- a/src/mastodon-cpp.hpp +++ b/src/mastodon-cpp.hpp @@ -65,6 +65,7 @@ namespace Mastodon * | 20 | Failed to connect | * | 21 | Couldn't resolve host | * | 22 | Network is unreachable | + * | 23 | Transfer interrupted | * | 100 - 999 | HTTP status codes | * | 65535 | Unknown exception | */