uerrno: Display on separate page.

Fixes https://github.com/pybricks/pybricks-api/issues/78
This commit is contained in:
Laurens Valk
2021-08-02 11:01:20 +02:00
parent 677656f669
commit 0b9280a8df
4 changed files with 36 additions and 40 deletions
+1
View File
@@ -121,6 +121,7 @@ Pybricks Documentation
micropython/builtins
micropython/exceptions
micropython/micropython
micropython/uerrno
micropython/uio
micropython/umath
micropython/urandom
+3 -38
View File
@@ -1,10 +1,6 @@
Exceptions and error codes
Exceptions and errors
=====================================================
List of all exceptions
----------------------
This section lists all available exceptions in alphabetical order.
.. autoclass:: ubuiltins.ArithmeticError
@@ -55,11 +51,11 @@ This section lists all available exceptions in alphabetical order.
.. autoclass:: ubuiltins.NotImplementedError
:no-members:
.. _OSError:
.. autoclass:: ubuiltins.OSError
:noindex:
See the `OSError`_ section for additional details.
.. autoclass:: ubuiltins.OverflowError
:no-members:
@@ -84,37 +80,6 @@ This section lists all available exceptions in alphabetical order.
.. autoclass:: ubuiltins.ZeroDivisionError
:no-members:
.. _OSError:
Using ``OSError`` with :mod:`uerrno`
------------------------------------
The ``errno`` attribute of an ``OSError`` indicates why the exception was
raised. This attribute has one of the following values, which can be imported
from the ``uerrno`` module. See also :ref:`this example <device_detection>`.
.. module:: uerrno
.. autodata:: uerrno.EAGAIN
.. autodata:: uerrno.EBUSY
.. autodata:: uerrno.ECANCELED
.. autodata:: uerrno.EINVAL
.. autodata:: uerrno.EIO
.. autodata:: uerrno.ENODEV
.. autodata:: uerrno.EOPNOTSUPP
.. autodata:: uerrno.EPERM
.. autodata:: uerrno.ETIMEDOUT
.. autodata:: uerrno.errorcode
Examples
---------------------
+28
View File
@@ -0,0 +1,28 @@
:mod:`uerrno <uerrno>` -- Error codes
============================================================
.. module:: uerrno
The ``errno`` attribute of an :ref:`OSError <OSError>` indicates why this
exception was raised. This attribute has one of the following values.
See also :ref:`this example <device_detection>`.
.. autodata:: uerrno.EAGAIN
.. autodata:: uerrno.EBUSY
.. autodata:: uerrno.ECANCELED
.. autodata:: uerrno.EINVAL
.. autodata:: uerrno.EIO
.. autodata:: uerrno.ENODEV
.. autodata:: uerrno.EOPNOTSUPP
.. autodata:: uerrno.EPERM
.. autodata:: uerrno.ETIMEDOUT
.. autodata:: uerrno.errorcode
+4 -2
View File
@@ -968,14 +968,16 @@ class NotImplementedError(RuntimeError):
class OSError(Exception):
"""
This exception is raised by the firmware, which is
the Operating System that runs on the hub. For example, it
the Operating System that runs on the hub.
For :ref:`example <device_detection>`, it
raises an ``OSError`` if you call ``Motor(Port.A)`` when there is no
motor on port A.
"""
errno: _int
"""
Specifies which kind of ``OSError`` occurred, as listed :ref:`here <OSError>`.
Specifies which kind of ``OSError`` occurred, as listed in the
:mod:`uerrno` module.
"""