Allow access to full packet on failed connectrelease/3.x.x
@@ -5,12 +5,13 @@ namespace MQTTnet.Adapter | |||||
{ | { | ||||
public class MqttConnectingFailedException : MqttCommunicationException | public class MqttConnectingFailedException : MqttCommunicationException | ||||
{ | { | ||||
public MqttConnectingFailedException(MqttClientConnectResultCode resultCode) | |||||
: base($"Connecting with MQTT server failed ({resultCode.ToString()}).") | |||||
public MqttConnectingFailedException(MqttClientAuthenticateResult result) | |||||
: base($"Connecting with MQTT server failed ({result.ResultCode.ToString()}).") | |||||
{ | { | ||||
ResultCode = resultCode; | |||||
Result = result; | |||||
} | } | ||||
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."); | ||||
@@ -139,7 +139,7 @@ namespace MQTTnet.Formatter.V5 | |||||
ReasonCode = connectionValidatorContext.ReasonCode, | ReasonCode = connectionValidatorContext.ReasonCode, | ||||
Properties = new MqttConnAckPacketProperties | Properties = new MqttConnAckPacketProperties | ||||
{ | { | ||||
UserProperties = connectionValidatorContext.UserProperties, | |||||
UserProperties = connectionValidatorContext.ResponseUserProperties, | |||||
AuthenticationMethod = connectionValidatorContext.AuthenticationMethod, | AuthenticationMethod = connectionValidatorContext.AuthenticationMethod, | ||||
AuthenticationData = connectionValidatorContext.ResponseAuthenticationData, | AuthenticationData = connectionValidatorContext.ResponseAuthenticationData, | ||||
AssignedClientIdentifier = connectionValidatorContext.AssignedClientIdentifier, | AssignedClientIdentifier = connectionValidatorContext.AssignedClientIdentifier, | ||||