public class MqttException extends RuntimeException
Modifier and Type | Field and Description |
---|---|
static short |
REASON_CODE_CLIENT_ALREADY_DISCONNECTED
The client is already disconnected.
|
static int |
REASON_CODE_CLIENT_CLOSED
The client is closed - no operations are permitted on the client in this state.
|
static int |
REASON_CODE_CLIENT_CONNECTED
The client is already connected.
|
static int |
REASON_CODE_CLIENT_EXCEPTION
Client encountered an exception.
|
static int |
REASON_CODE_CLIENT_NOT_CONNECTED
The client is not connected to the server.
|
static int |
REASON_CODE_CLIENT_TIMEOUT
Client timed out while waiting for a response from the server.
|
static int |
REASON_CODE_CONNECTION_LOST
The client has been unexpectedly disconnected from the server.
|
static int |
REASON_CODE_INVALID_MESSAGE
Protocol error: the message was not recognized as a valid MQTT packet.
|
static int |
REASON_CODE_SERVER_CONNECT_ERROR
Unable to connect to server.
|
static int |
REASON_CODE_SERVER_EXPECTED_CLEAN_SESSION
Server inconsistency (clean session not accepted).
|
static int |
REASON_CODE_SERVER_MESSAGE_LENGTH_OVERFLOW
Server inconsistency (message length integer overflow).
|
static int |
REASON_CODE_SERVER_UNEXPECTED_ACK_MESSAGE
Server inconsistency (received message acknowledgment to unexpected action).
|
static int |
REASON_CODE_SERVER_UNEXPECTED_ACK_PACKET_IDENTIFIER
Server inconsistency (received message acknowledgment to unexpected packet identifier).
|
static int |
REASON_CODE_SERVER_UNEXPECTED_PINGRESP_MESSAGE
Server inconsistency (received unexpected ping response packet).
|
static int |
REASON_CODE_SUBSCRIBE_FAILED
Error from subscribe - returned from the server.
|
Constructor and Description |
---|
MqttException(int reasonCode)
Constructs a new
MqttException with the specified code as the underlying reason. |
MqttException(int reason,
Throwable cause)
Constructs a new
MqttException with the specified Throwable as the underlying reason. |
MqttException(Throwable cause)
Constructs a new
MqttException with the specified Throwable as the underlying reason. |
Modifier and Type | Method and Description |
---|---|
String |
getMessage()
Returns the detail message for this exception.
|
int |
getReasonCode()
Returns the reason code for this exception.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, toString
public static final short REASON_CODE_CLIENT_ALREADY_DISCONNECTED
public static final int REASON_CODE_CLIENT_CLOSED
public static final int REASON_CODE_CLIENT_CONNECTED
public static final int REASON_CODE_CLIENT_EXCEPTION
Throwable.getCause()
method to get the underlying reason.public static final int REASON_CODE_CLIENT_NOT_CONNECTED
MqttClient.connect()
or
MqttClient.connect(MqttConnectOptions)
method must be called first. It is also possible that the
connection was lost - see MqttClient.setCallback(MqttCallback)
for a way to track lost connections.public static final int REASON_CODE_CLIENT_TIMEOUT
public static final int REASON_CODE_CONNECTION_LOST
cause
will provide more
details.public static final int REASON_CODE_INVALID_MESSAGE
public static final int REASON_CODE_SERVER_CONNECT_ERROR
public static final int REASON_CODE_SERVER_EXPECTED_CLEAN_SESSION
public static final int REASON_CODE_SERVER_MESSAGE_LENGTH_OVERFLOW
public static final int REASON_CODE_SERVER_UNEXPECTED_ACK_MESSAGE
public static final int REASON_CODE_SERVER_UNEXPECTED_ACK_PACKET_IDENTIFIER
public static final int REASON_CODE_SERVER_UNEXPECTED_PINGRESP_MESSAGE
public static final int REASON_CODE_SUBSCRIBE_FAILED
public MqttException(int reasonCode)
MqttException
with the specified code as the underlying reason.reasonCode
- the reason code for the exception.public MqttException(int reason, Throwable cause)
MqttException
with the specified Throwable
as the underlying reason.reason
- the reason code for the exception.cause
- the underlying cause of the exception.public MqttException(Throwable cause)
MqttException
with the specified Throwable
as the underlying reason.cause
- the underlying cause of the exception.@NonNull public String getMessage()
getMessage
in class Throwable
null
.public int getReasonCode()