summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-07-03 00:55:09 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-07-03 00:55:09 +0300
commitffb13cc63366a4356a3a26df8e4b27632fd71f76 (patch)
tree1a71da0eefcdeb9e3741d7b3979c49028555f583
parent4f23c5d58738cd443d43b8e01cbd2a90ae6a8c9d (diff)
downloadmicropython-ffb13cc63366a4356a3a26df8e4b27632fd71f76.tar.gz
micropython-ffb13cc63366a4356a3a26df8e4b27632fd71f76.zip
docs/uerrno: Document "uerrno" module.
-rw-r--r--docs/library/index.rst3
-rw-r--r--docs/library/uerrno.rst34
2 files changed, 37 insertions, 0 deletions
diff --git a/docs/library/index.rst b/docs/library/index.rst
index 8a59628e2d..e884f266ee 100644
--- a/docs/library/index.rst
+++ b/docs/library/index.rst
@@ -77,6 +77,7 @@ it will fallback to loading the built-in ``ujson`` module.
sys.rst
ubinascii.rst
ucollections.rst
+ uerrno.rst
uhashlib.rst
uheapq.rst
uio.rst
@@ -102,6 +103,7 @@ it will fallback to loading the built-in ``ujson`` module.
sys.rst
ubinascii.rst
ucollections.rst
+ uerrno.rst
uhashlib.rst
uheapq.rst
uio.rst
@@ -144,6 +146,7 @@ it will fallback to loading the built-in ``ujson`` module.
sys.rst
ubinascii.rst
ucollections.rst
+ uerrno.rst
uhashlib.rst
uheapq.rst
uio.rst
diff --git a/docs/library/uerrno.rst b/docs/library/uerrno.rst
new file mode 100644
index 0000000000..0cdcc84487
--- /dev/null
+++ b/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