aboutsummaryrefslogtreecommitdiff
path: root/tests/cpydiff/types_exception_attrs.py
blob: ad72b62a61a5dbbdec3dd3f8edc943246b1de8e1 (plain)
1
2
3
4
5
6
7
8
9
"""
categories: Types,Exception
description: All exceptions have readable ``value`` and ``errno`` attributes, not just ``StopIteration`` and ``OSError``.
cause: MicroPython is optimised to reduce code size.
workaround: Only use ``value`` on ``StopIteration`` exceptions, and ``errno`` on ``OSError`` exceptions.  Do not use or rely on these attributes on other exceptions.
"""
e = Exception(1)
print(e.value)
print(e.errno)