tgbot-cpp
Loading...
Searching...
No Matches
TgException.h
Go to the documentation of this file.
1#pragma once
2
3#include "tgbot/Types.h"
4#include "tgbot/export.h"
5
6#include <stdexcept>
7#include <string>
8#include <string_view>
9
10namespace TgBot {
11
17class TGBOT_API TgException : public std::runtime_error {
18public:
22 enum class ErrorCode : size_t {
23 Undefined = 0,
24 BadRequest = 400,
25 Unauthorized = 401,
26 Forbidden = 403,
27 NotFound = 404,
28 Flood = 429,
29 Internal = 500,
30 HtmlResponse = 100,
31 InvalidJson = 101
32 };
33
34 TgException(std::string_view description, ErrorCode errorCode,
35 std::shared_ptr<ResponseParameters> parameters = nullptr);
36
38
42 const std::shared_ptr<ResponseParameters> parameters;
43};
44
45} // namespace TgBot
const ErrorCode errorCode
Definition TgException.h:37
ErrorCode
Enum of possible errors from Api requests.
Definition TgException.h:22
TgException(std::string_view description, ErrorCode errorCode, std::shared_ptr< ResponseParameters > parameters=nullptr)
const std::shared_ptr< ResponseParameters > parameters
Additional details about the error returned by Telegram, if any.
Definition TgException.h:42
#define TGBOT_API
Definition export.h:5
Definition Api.h:18