24#ifndef __mqtt_exception_h
25#define __mqtt_exception_h
93 const char *msg = ::MQTTAsync_strerror(rc);
103 auto msg = ::MQTTReasonCode_toString(MQTTReasonCodes(reasonCode));
104 if (msg)
return string(msg);
118 const string& msg=
string()) {
119 string s =
"MQTT error [" + std::to_string(rc) +
"]";
184 :
exception(MQTTASYNC_FAILURE,
"Missing "+rsp+
" response") {}
225 :
exception(MQTTCLIENT_PERSISTENCE_ERROR, msg) {}
Definition exception.h:47
exception(int rc)
Definition exception.h:61
static string reason_code_str(int reasonCode)
Definition exception.h:101
string to_string() const
Definition exception.h:157
static string error_str(int rc)
Definition exception.h:92
static string printable_error(int rc, int reasonCode=ReasonCode::SUCCESS, const string &msg=string())
Definition exception.h:117
int get_return_code() const
Definition exception.h:129
int rc_
Definition exception.h:50
string msg_
Definition exception.h:54
ReasonCode reasonCode_
Definition exception.h:52
exception(int rc, ReasonCode reasonCode)
Definition exception.h:68
int get_reason_code() const
Definition exception.h:139
string get_reason_code_str() const
Definition exception.h:146
string get_message() const
Definition exception.h:152
exception(int rc, const string &msg)
Definition exception.h:75
string get_error_str() const
Definition exception.h:134
exception(int rc, ReasonCode reasonCode, const string &msg)
Definition exception.h:84
Definition exception.h:177
missing_response(const string &rsp)
Definition exception.h:183
Definition exception.h:209
persistence_exception(const string &msg)
Definition exception.h:224
persistence_exception(int code)
Definition exception.h:219
persistence_exception()
Definition exception.h:214
persistence_exception(int code, const string &msg)
Definition exception.h:231
Definition exception.h:242
security_exception(int code)
Definition exception.h:248
security_exception(int code, const string &msg)
Definition exception.h:254
Definition exception.h:194
timeout_error()
Definition exception.h:199
Definition async_client.h:49
ReasonCode
Definition types.h:57
@ SUCCESS
Definition types.h:58
@ MQTTPP_V3_CODE
Definition types.h:103
std::bad_cast bad_cast
Definition exception.h:38
std::string string
Definition types.h:40
std::ostream & operator<<(std::ostream &os, const buffer_ref< T > &buf)
Definition buffer_ref.h:279