Improve error for invalid parameters

This commit is contained in:
Scott Shawcroft 2021-05-19 14:09:11 -07:00
parent ee7a701487
commit 42ee48ccb5
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA
2 changed files with 8 additions and 1 deletions

View File

@ -1211,6 +1211,10 @@ msgstr ""
msgid "Invalid AuthMode"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
msgid "Invalid BLE parameter"
msgstr ""
#: shared-module/displayio/OnDiskBitmap.c
msgid "Invalid BMP file"
msgstr ""
@ -2316,7 +2320,7 @@ msgstr ""
msgid "Unsupported format"
msgstr ""
#: ports/raspberrypi/common-hal/pulseio/PulseOut.c py/moduerrno.c
#: py/moduerrno.c
msgid "Unsupported operation"
msgstr ""

View File

@ -52,6 +52,9 @@ void check_nrf_error(uint32_t err_code) {
case NRF_ERROR_TIMEOUT:
mp_raise_msg(&mp_type_TimeoutError, NULL);
return;
case NRF_ERROR_INVALID_PARAM:
mp_raise_ValueError(translate("Invalid BLE parameter"));
return;
case BLE_ERROR_INVALID_CONN_HANDLE:
mp_raise_ConnectionError(translate("Not connected"));
return;