add non-native exception in traceback_test

Co-authored-by: Dan Halbert <halbert@adafruit.com>
This commit is contained in:
microDev 2021-12-15 12:34:56 +05:30
parent 70b3e73349
commit 7e46387196
No known key found for this signature in database
GPG Key ID: 2C0867BE60967730
2 changed files with 16 additions and 0 deletions

View File

@ -22,4 +22,15 @@ except Exception as exc:
traceback.print_exception(None, exc, exc.__traceback__, limit=0) traceback.print_exception(None, exc, exc.__traceback__, limit=0)
print("\nLimit=-1 Trace:") print("\nLimit=-1 Trace:")
traceback.print_exception(None, exc, exc.__traceback__, limit=-1) traceback.print_exception(None, exc, exc.__traceback__, limit=-1)
class NonNativeException(Exception):
pass
try:
raise NonNativeException("test")
except Exception as e:
print("\nNonNative Trace:")
traceback.print_exception(None, e, e.__traceback__)
print("") print("")

View File

@ -21,3 +21,8 @@ Traceback (most recent call last):
File "circuitpython/traceback_test.py", line 9, in fun File "circuitpython/traceback_test.py", line 9, in fun
Exception: test Exception: test
NonNative Trace:
Traceback (most recent call last):
File "circuitpython/traceback_test.py", line 32, in <module>
NonNativeException: test