Browse Source

docs/uerrno: Document "uerrno" module.

pull/3192/head
Paul Sokolovsky 7 years ago
parent
commit
ffb13cc633
  1. 3
      docs/library/index.rst
  2. 34
      docs/library/uerrno.rst

3
docs/library/index.rst

@ -77,6 +77,7 @@ it will fallback to loading the built-in ``ujson`` module.
sys.rst sys.rst
ubinascii.rst ubinascii.rst
ucollections.rst ucollections.rst
uerrno.rst
uhashlib.rst uhashlib.rst
uheapq.rst uheapq.rst
uio.rst uio.rst
@ -102,6 +103,7 @@ it will fallback to loading the built-in ``ujson`` module.
sys.rst sys.rst
ubinascii.rst ubinascii.rst
ucollections.rst ucollections.rst
uerrno.rst
uhashlib.rst uhashlib.rst
uheapq.rst uheapq.rst
uio.rst uio.rst
@ -144,6 +146,7 @@ it will fallback to loading the built-in ``ujson`` module.
sys.rst sys.rst
ubinascii.rst ubinascii.rst
ucollections.rst ucollections.rst
uerrno.rst
uhashlib.rst uhashlib.rst
uheapq.rst uheapq.rst
uio.rst uio.rst

34
docs/library/uerrno.rst

@ -0,0 +1,34 @@
:mod:`uerrno` -- system error codes
===================================
.. module:: uerrno
:synopsis: system error codes
|see_cpython_module| :mod:`python:errno`.
This module provides access to symbolic error codes for `OSError` exception.
A particular inventory of codes depends on `MicroPython port`.
Constants
---------
.. data:: EEXIST, EAGAIN, etc.
Error codes, based on ANSI C/POSIX standard. All error codes start with
"E". As mentioned above, inventory of the codes depends on
`MicroPython port`. Errors are usually accessible as ``exc.args[0]``
where `exc` is an instance of `OSError`. Usage example::
try:
uos.mkdir("my_dir")
except OSError as exc:
if exc.args[0] == uerrno.EEXIST:
print("Directory already exists")
.. data:: errorcode
Dictionary mapping numeric error codes to strings with symbolic error
code (see above)::
>>> print(uerrno.errorcode[uerrno.EEXIST])
EEXIST
Loading…
Cancel
Save