24#ifndef __mqtt_exception_h
25#define __mqtt_exception_h
100 const char* msg = ::MQTTAsync_strerror(rc);
109 auto msg = ::MQTTReasonCode_toString(MQTTReasonCodes(reasonCode));
110 return (msg) ?
string{msg} :
string{};
126 string s =
"MQTT error [" + std::to_string(rc) +
"]";
187 :
exception(MQTTASYNC_FAILURE,
"Missing " + rsp +
" response") {}
227 :
exception(MQTTCLIENT_PERSISTENCE_ERROR, msg) {}
Definition exception.h:48
exception(int rc)
Definition exception.h:69
static string reason_code_str(int reasonCode)
Definition exception.h:108
string to_string() const
Definition exception.h:160
static string error_str(int rc)
Definition exception.h:99
int get_return_code() const
Definition exception.h:136
int rc_
Definition exception.h:51
string msg_
Definition exception.h:55
ReasonCode reasonCode_
Definition exception.h:53
exception(int rc, ReasonCode reasonCode)
Definition exception.h:75
static ReasonCode reason_code(int rc, ReasonCode reasonCode)
Definition exception.h:58
int get_reason_code() const
Definition exception.h:146
string get_reason_code_str() const
Definition exception.h:151
static string printable_error(int rc, ReasonCode reasonCode=ReasonCode::SUCCESS, const string &msg=string())
Definition exception.h:121
string get_message() const
Definition exception.h:155
exception(int rc, const string &msg)
Definition exception.h:82
string get_error_str() const
Definition exception.h:141
exception(int rc, ReasonCode reasonCode, const string &msg)
Definition exception.h:89
missing_response(const string &rsp)
Definition exception.h:186
persistence_exception(const string &msg)
Definition exception.h:226
persistence_exception(int code)
Definition exception.h:221
persistence_exception()
Definition exception.h:216
persistence_exception(int code, const string &msg)
Definition exception.h:233
security_exception(int code)
Definition exception.h:249
security_exception(int code, const string &msg)
Definition exception.h:255
timeout_error()
Definition exception.h:201
Definition async_client.h:60
ReasonCode
Definition reason_code.h:39
@ SUCCESS
Definition reason_code.h:40
@ UNSPECIFIED_ERROR
Definition reason_code.h:50
std::bad_cast bad_cast
Definition exception.h:39
std::string string
Definition types.h:43
std::ostream & operator<<(std::ostream &os, const buffer_ref< T > &buf)
Definition buffer_ref.h:286