Skip to content

Commit c231c89

Browse files
committed
extmod/network_ninaw10: Fix error messages.
Signed-off-by: iabdalkader <[email protected]>
1 parent 2b6f81f commit c231c89

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

extmod/network_ninaw10.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ static void network_ninaw10_poll_connect(mp_sched_node_t *node) {
153153
debug_printf("poll_connect() status: %d reason %d\n", status, reason);
154154
if (nina_connect(self->ssid, self->security, self->key, 0) != 0) {
155155
mp_raise_msg_varg(&mp_type_OSError,
156-
MP_ERROR_TEXT("could not connect to ssid=%s, sec=%d, key=%s\n"),
156+
MP_ERROR_TEXT("could not connect to ssid=%s, sec=%d, key=%s"),
157157
self->ssid, self->security, self->key);
158158
}
159159
} else {
@@ -197,14 +197,14 @@ static mp_obj_t network_ninaw10_active(size_t n_args, const mp_obj_t *args) {
197197
int error = 0;
198198
if ((error = nina_init()) != 0) {
199199
mp_raise_msg_varg(&mp_type_OSError,
200-
MP_ERROR_TEXT("Failed to initialize Nina-W10 module, error: %d\n"), error);
200+
MP_ERROR_TEXT("failed to initialize Nina-W10 module, error: %d"), error);
201201
}
202202
// check firmware version
203203
uint8_t semver[NINA_FW_VER_LEN];
204204
if (nina_fw_version(semver) != 0) {
205205
nina_deinit();
206206
mp_raise_msg_varg(&mp_type_OSError,
207-
MP_ERROR_TEXT("Failed to read firmware version, error: %d\n"), error);
207+
MP_ERROR_TEXT("failed to read firmware version, error: %d"), error);
208208
}
209209
// Check the minimum supported firmware version.
210210
uint32_t fwmin = (NINA_FW_VER_MIN_MAJOR * 100) +
@@ -217,7 +217,7 @@ static mp_obj_t network_ninaw10_active(size_t n_args, const mp_obj_t *args) {
217217

218218
if (fwver < fwmin) {
219219
mp_raise_msg_varg(&mp_type_OSError,
220-
MP_ERROR_TEXT("Firmware version mismatch. Minimum supported firmware is v%d.%d.%d found v%d.%d.%d\n"),
220+
MP_ERROR_TEXT("firmware version mismatch, minimum supported firmware is v%d.%d.%d found v%d.%d.%d"),
221221
NINA_FW_VER_MIN_MAJOR, NINA_FW_VER_MIN_MINOR, NINA_FW_VER_MIN_PATCH, semver[NINA_FW_VER_MAJOR_OFFS] - 48,
222222
semver[NINA_FW_VER_MINOR_OFFS] - 48, semver[NINA_FW_VER_PATCH_OFFS] - 48);
223223
}
@@ -273,7 +273,7 @@ static mp_obj_t network_ninaw10_connect(mp_uint_t n_args, const mp_obj_t *pos_ar
273273
const char *ssid = mp_obj_str_get_str(args[ARG_ssid].u_obj);
274274

275275
if (strlen(ssid) == 0) {
276-
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("SSID can't be empty!"));
276+
mp_raise_ValueError(MP_ERROR_TEXT("SSID can't be empty"));
277277
}
278278

279279
// get encryption key
@@ -292,7 +292,7 @@ static mp_obj_t network_ninaw10_connect(mp_uint_t n_args, const mp_obj_t *pos_ar
292292

293293
// Ensure that the key is not empty if a security mode is used.
294294
if (security != NINA_SEC_OPEN && strlen(key) == 0) {
295-
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("Key can't be empty!"));
295+
mp_raise_ValueError(MP_ERROR_TEXT("key can't be empty"));
296296
}
297297

298298
// Activate the interface if not active.
@@ -309,7 +309,7 @@ static mp_obj_t network_ninaw10_connect(mp_uint_t n_args, const mp_obj_t *pos_ar
309309
// Initialize WiFi in Station mode.
310310
if (nina_connect(ssid, security, key, 0) != 0) {
311311
mp_raise_msg_varg(&mp_type_OSError,
312-
MP_ERROR_TEXT("could not connect to ssid=%s, sec=%d, key=%s\n"), ssid, security, key);
312+
MP_ERROR_TEXT("could not connect to ssid=%s, sec=%d, key=%s"), ssid, security, key);
313313
}
314314

315315
// Save connection info to re-connect if needed.

0 commit comments

Comments
 (0)