32 namespace kiteconnect {
54 : Code(Code_), Message(std::move(Message_)) {};
61 [[nodiscard]]
const char*
what()
const noexcept
override = 0;
68 [[nodiscard]]
int code() const noexcept {
return Code; };
75 [[nodiscard]]
const char*
message() const noexcept {
76 return Message.c_str();
92 [[nodiscard]]
const char*
what() const noexcept
override {
93 return "TokenException was thrown by Kite";
105 [[nodiscard]]
const char*
what() const noexcept
override {
106 return "UserException was thrown by Kite";
118 [[nodiscard]]
const char*
what() const noexcept
override {
119 return "OrderException was thrown by Kite";
131 [[nodiscard]]
const char*
what() const noexcept
override {
132 return "InputException was thrown by Kite";
147 [[nodiscard]]
const char*
what() const noexcept
override {
148 return "NetworkException was thrown by Kite";
160 [[nodiscard]]
const char*
what() const noexcept
override {
161 return "DataException was thrown by Kite";
173 [[nodiscard]]
const char*
what() const noexcept
override {
174 return "GeneralException was thrown by Kite";
186 [[nodiscard]]
const char*
what() const noexcept
override {
187 return "PermissionException was thrown by Kite";
200 [[nodiscard]]
const char*
what() const noexcept
override {
201 return "unknown exception was thrown by Kite";
209 explicit libException(
string Message): message(std::move(Message)) {};
216 const char*
what() {
return message.c_str(); };
223 inline void throwException(
224 const string& exceptionString,
int code,
const string& msg) {
226 static const string tokenExceptionString =
"TokenException";
227 static const string userExceptionString =
"UserException";
228 static const string orderExcptionString =
"OrderException";
229 static const string inputExceptionString =
"InputException";
230 static const string networkExceptionString =
"NetworkException";
231 static const string dataExceptionString =
"DataException";
232 static const string generalExceptionString =
"GeneralException";
233 static const string permissionExceptionString =
"PermissionException";
237 static const string unknownExceptionString =
"NoException";
239 if (exceptionString == tokenExceptionString) {
240 throw tokenException(code, msg);
242 if (exceptionString == userExceptionString) {
243 throw userException(code, msg);
245 if (exceptionString == orderExcptionString) {
246 throw orderException(code, msg);
248 if (exceptionString == inputExceptionString) {
249 throw inputException(code, msg);
251 if (exceptionString == networkExceptionString) {
252 throw networkException(code, msg);
254 if (exceptionString == dataExceptionString) {
255 throw dataException(code, msg);
257 if (exceptionString == generalExceptionString) {
258 throw generalException(code, msg);
260 if (exceptionString == permissionExceptionString) {
261 throw permissionException(code, msg);
263 if (exceptionString == unknownExceptionString) {
264 throw unknownException(code, msg);
267 throw libException(
"unknown exception was thrown by REST API");
This exception is thrown when REST API doesn't return a HTTP OK 200 code but doesn't return any excep...
Definition: exceptions.hpp:193
Represents user account related errors.
Definition: exceptions.hpp:98
This exception is thrown when an error occures at the library level.
Definition: exceptions.hpp:206
CPPKiteConnect saves you the hassle of detecting API errors by manually checking HTTP codes or JSON e...
Definition: exceptions.hpp:50
int code() const noexcept
Get HTTP code sent by the REST API.
Definition: exceptions.hpp:68
Represents all token and authentication related errors.
Definition: exceptions.hpp:85
const char * what() const noexcept override
Provides short descripion of the error.
Definition: exceptions.hpp:173
Represents a network issue between Kite and the backend Order Management System (OMS).
Definition: exceptions.hpp:140
const char * what() const noexcept override
Provides short descripion of the error.
Definition: exceptions.hpp:92
const char * what() const noexcept override
Provides short descripion of the error.
Definition: exceptions.hpp:200
const char * what() const noexcept override
Provides short descripion of the error.
Definition: exceptions.hpp:160
An unclassified, general error.
Definition: exceptions.hpp:166
const char * what() const noexcept override
Provides short descripion of the error.
Definition: exceptions.hpp:186
const char * message() const noexcept
Get error message sent by the REST API.
Definition: exceptions.hpp:75
Represents all order placement and manipulation errors.
Definition: exceptions.hpp:111
const char * what() const noexcept override=0
Provides short descripion of the error.
const char * what() const noexcept override
Provides short descripion of the error.
Definition: exceptions.hpp:118
Represents permission denied exceptions for certain calls.
Definition: exceptions.hpp:179
const char * what()
Provides short description of the error.
Definition: exceptions.hpp:216
const char * what() const noexcept override
Provides short descripion of the error.
Definition: exceptions.hpp:147
const char * what() const noexcept override
Provides short descripion of the error.
Definition: exceptions.hpp:105
Represents a bad response from the backend Order Management System.
Definition: exceptions.hpp:153