Skip to content

Commit 609115a

Browse files
committed
doc/esp32/quickref.rst: Add Error handling.
1 parent 14a43ec commit 609115a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/esp32/quickref.rst

+26
Original file line numberDiff line numberDiff line change
@@ -806,3 +806,29 @@ the corresponding functions, or you can use the command-line client
806806

807807
See the MicroPython forum for other community-supported alternatives
808808
to transfer files to an ESP32 board.
809+
810+
Error handling
811+
--------------
812+
813+
To raise eroor from MicroPython module::
814+
815+
import errno
816+
raise(OSError(errno.ETIMEDOUT))
817+
818+
>>> OSError: [Errno 116] ETIMEDOUT
819+
820+
or::
821+
822+
raise(ValueError('Must be positive'))
823+
824+
>>> ValueError: Must be positive
825+
826+
Internally in C code esp-idf raises ecceptions in format::
827+
828+
>>> OSError: (-12293, 0x3005, 'ESP_ERR_WIFI_MODE')
829+
830+
Additional information about error codes see on Espressif esp-idf
831+
`esp_err.h <https://github.com/espressif/esp-idf/blob/master/components/esp_common/include/esp_err.h>`_,
832+
`esp_wifi.h <https://github.com/espressif/esp-idf/blob/master/components/esp_wifi/include/esp_wifi.h>`_,
833+
`esp_netif_types.h <https://github.com/espressif/esp-idf/blob/master/components/esp_netif/include/esp_netif_types.h>`_
834+
etc.

0 commit comments

Comments
 (0)