diff options
Diffstat (limited to 'include/tgbot')
-rw-r--r-- | include/tgbot/Api.h | 2 | ||||
-rw-r--r-- | include/tgbot/TgException.h | 16 |
2 files changed, 16 insertions, 2 deletions
diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h index 7db68e7..6bd24e4 100644 --- a/include/tgbot/Api.h +++ b/include/tgbot/Api.h @@ -1989,7 +1989,7 @@ public: const HttpClient& _httpClient; -private: +protected: boost::property_tree::ptree sendRequest(const std::string& method, const std::vector<HttpReqArg>& args = std::vector<HttpReqArg>()) const; const std::string _token; diff --git a/include/tgbot/TgException.h b/include/tgbot/TgException.h index e80711c..0fbda93 100644 --- a/include/tgbot/TgException.h +++ b/include/tgbot/TgException.h @@ -16,7 +16,21 @@ namespace TgBot { class TGBOT_API TgException : public std::runtime_error { public: - explicit TgException(const std::string& description); + + /** + * @brief Enum of possible errors from Api requests + */ + enum class ErrorCode : size_t { + Undefined = 0, + BadRequest = 400, Unauthorized = 401, + Forbidden = 403, NotFound = 404, + Flood = 402, Internal = 500, + HtmlResponse = 100, InvalidJson = 101 + }; + + explicit TgException(const std::string& description, ErrorCode errorCode); + + const ErrorCode errorCode; }; } |