summaryrefslogtreecommitdiff
path: root/include/tgbot/TgException.h
diff options
context:
space:
mode:
authorOleg Morozenkov <m@oleg.rocks>2023-12-02 12:30:31 +0300
committerGitHub <noreply@github.com>2023-12-02 12:30:31 +0300
commitf1c2dbad1c9674f82e61b7cf76cdc618a2dba852 (patch)
tree66f31434af61a5b4dda9a3591d67fc528273b505 /include/tgbot/TgException.h
parent782596206764e663b9b45401b447871f21ce62b2 (diff)
parent658f37f93d1a0c31c447adb3022cfd6cee4a1876 (diff)
Merge pull request #289 from Temomik/master
Added ability to handle error codes from all Api requests
Diffstat (limited to 'include/tgbot/TgException.h')
-rw-r--r--include/tgbot/TgException.h16
1 files changed, 15 insertions, 1 deletions
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;
};
}