uerrno: Document alongside OSError.

These are meant to be used together, so document them in the same place along with a practical example.
This commit is contained in:
Laurens Valk
2021-07-19 15:03:10 +02:00
parent 2c32d093d0
commit e8d47ffca1
4 changed files with 40 additions and 16 deletions
+6 -7
View File
@@ -967,15 +967,15 @@ class NotImplementedError(RuntimeError):
class OSError(Exception):
"""
This exception is raised when a system function returns a system-related
error, including I/O failures.
This exception is raised by the firmware, which is
the Operating System that runs on the hub. For example, it
raises an ``OSError`` if you call ``Motor(Port.A)`` when there is no
motor on port A.
"""
errno: _int
"""
A numeric error code.
Also see :mod:`uerrno`.
Specifies which kind of ``OSError`` occurred, as listed below.
"""
@@ -1010,8 +1010,7 @@ class SyntaxError(Exception):
class SystemExit(BaseException):
"""
This exception is raised when the stop button is pressed (on the hub or in
the IDE).
Raised when you press the stop button on the hub or in the Pybricks Code app.
"""
+1 -5
View File
@@ -61,9 +61,5 @@ The operation timed out.
errorcode: Dict[int, str]
"""
Dictionary mapping numeric error codes to strings with symbolic error
code (see above)::
>>> print(uerrno.errorcode[uerrno.EEXIST])
EEXIST
Dictionary that maps numeric error codes to strings with symbolic error code.
"""