diff options
author | Damien George <damien.p.george@gmail.com> | 2016-10-07 14:00:51 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-10-07 14:00:51 +1100 |
commit | 23a568240d9fb216c5f2ca9feeb3134725c9eea0 (patch) | |
tree | f814b2b6c03910604797263c23e58b8a5c353c0c /esp8266/modesp.c | |
parent | a2bfcbe029a4c0d47efe5b1b51d4cd2c010f748d (diff) | |
download | micropython-23a568240d9fb216c5f2ca9feeb3134725c9eea0.tar.gz micropython-23a568240d9fb216c5f2ca9feeb3134725c9eea0.zip |
esp8266: Use mp_raise_OSError helper function.
Diffstat (limited to 'esp8266/modesp.c')
-rw-r--r-- | esp8266/modesp.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/esp8266/modesp.c b/esp8266/modesp.c index 9a7d4ad18f..e081f57dab 100644 --- a/esp8266/modesp.c +++ b/esp8266/modesp.c @@ -583,7 +583,7 @@ STATIC mp_obj_t esp_flash_read(mp_obj_t offset_in, mp_obj_t len_or_buf_in) { if (alloc_buf) { m_del(byte, buf, len); } - nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(res == SPI_FLASH_RESULT_TIMEOUT ? MP_ETIMEDOUT : MP_EIO))); + mp_raise_OSError(res == SPI_FLASH_RESULT_TIMEOUT ? MP_ETIMEDOUT : MP_EIO); } STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp_flash_read_obj, esp_flash_read); @@ -598,9 +598,7 @@ STATIC mp_obj_t esp_flash_write(mp_obj_t offset_in, const mp_obj_t buf_in) { if (res == SPI_FLASH_RESULT_OK) { return mp_const_none; } - nlr_raise(mp_obj_new_exception_arg1( - &mp_type_OSError, - MP_OBJ_NEW_SMALL_INT(res == SPI_FLASH_RESULT_TIMEOUT ? MP_ETIMEDOUT : MP_EIO))); + mp_raise_OSError(res == SPI_FLASH_RESULT_TIMEOUT ? MP_ETIMEDOUT : MP_EIO); } STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp_flash_write_obj, esp_flash_write); @@ -610,9 +608,7 @@ STATIC mp_obj_t esp_flash_erase(mp_obj_t sector_in) { if (res == SPI_FLASH_RESULT_OK) { return mp_const_none; } - nlr_raise(mp_obj_new_exception_arg1( - &mp_type_OSError, - MP_OBJ_NEW_SMALL_INT(res == SPI_FLASH_RESULT_TIMEOUT ? MP_ETIMEDOUT : MP_EIO))); + mp_raise_OSError(res == SPI_FLASH_RESULT_TIMEOUT ? MP_ETIMEDOUT : MP_EIO); } STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_flash_erase_obj, esp_flash_erase); |