Skip to content

Commit

Permalink
LTE: init() more expressive exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-pycom committed Mar 23, 2020
1 parent 85007f9 commit 82c17cb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions esp32/mods/modlte.c
Expand Up @@ -446,22 +446,22 @@ static mp_obj_t lte_init_helper(lte_obj_t *self, const mp_arg_val_t *args) {
MP_THREAD_GIL_ENTER();
if (E_LTE_MODEM_DISCONNECTED == lteppp_modem_state()) {
xSemaphoreGive(xLTE_modem_Conn_Sem);
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, "Couldn't connect to Modem!"));
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, "Couldn't connect to Modem (modem_state=disconnected)"));
}
break;
case E_LTE_MODEM_CONNECTING:
// Block till modem is connected
xSemaphoreTake(xLTE_modem_Conn_Sem, portMAX_DELAY);
if (E_LTE_MODEM_DISCONNECTED == lteppp_modem_state()) {
xSemaphoreGive(xLTE_modem_Conn_Sem);
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, "Couldn't connect to Modem!"));
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, "Couldn't connect to Modem (modem_state=connecting)"));
}
break;
case E_LTE_MODEM_CONNECTED:
//continue
break;
default:
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, "Couldn't connect to Modem!"));
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, "Couldn't connect to Modem (modem_state=default)"));
break;
}
lte_obj.cid = args[1].u_int;
Expand Down

0 comments on commit 82c17cb

Please sign in to comment.