Skip to content

Commit 530d3e0

Browse files
committed
Print error code in sn-client
1 parent 9c74c77 commit 530d3e0

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

examples/sn-client/sn-client.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,15 @@ int sn_test(MQTTCtx *mqttCtx)
178178
/* Send Connect and wait for Connect Ack */
179179
rc = SN_Client_Connect(&mqttCtx->client, connect);
180180

181+
if (rc != MQTT_CODE_SUCCESS) {
182+
PRINTF("MQTT-SN Connect: %s (%d)",
183+
MqttClient_ReturnCodeToString(rc), rc);
184+
goto disconn;
185+
}
186+
181187
/* Validate Connect Ack info */
182188
PRINTF("....MQTT-SN Connect Ack: Return Code %u",
183189
connect->ack.return_code);
184-
if (rc != MQTT_CODE_SUCCESS) {
185-
goto disconn;
186-
}
187190
}
188191

189192
/* Either the register or the subscribe block could be used to get the

0 commit comments

Comments
 (0)