mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-26 16:24:10 +08:00
Provide the full ACK on a connection failure
There are some systems that return information on a failed exception and thus the client wants access to the full set of ACK information. Specifically the user properties.
This commit is contained in:
@@ -5,12 +5,13 @@ namespace MQTTnet.Adapter
|
|||||||
{
|
{
|
||||||
public class MqttConnectingFailedException : MqttCommunicationException
|
public class MqttConnectingFailedException : MqttCommunicationException
|
||||||
{
|
{
|
||||||
public MqttConnectingFailedException(MqttClientConnectResultCode resultCode)
|
public MqttConnectingFailedException(MqttClientAuthenticateResult resultCode)
|
||||||
: base($"Connecting with MQTT server failed ({resultCode.ToString()}).")
|
: base($"Connecting with MQTT server failed ({resultCode.ToString()}).")
|
||||||
{
|
{
|
||||||
ResultCode = resultCode;
|
Result = resultCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MqttClientConnectResultCode ResultCode { get; }
|
public MqttClientAuthenticateResult Result { get; }
|
||||||
|
public MqttClientConnectResultCode ResultCode => Result.ResultCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ namespace MQTTnet.Client
|
|||||||
|
|
||||||
if (result.ResultCode != MqttClientConnectResultCode.Success)
|
if (result.ResultCode != MqttClientConnectResultCode.Success)
|
||||||
{
|
{
|
||||||
throw new MqttConnectingFailedException(result.ResultCode);
|
throw new MqttConnectingFailedException(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.Verbose("Authenticated MQTT connection with server established.");
|
_logger.Verbose("Authenticated MQTT connection with server established.");
|
||||||
|
|||||||
Reference in New Issue
Block a user