If I catch all exceptions, how can I see what exception was raised?
I know that it's normally considered bad practise to catch all, but I would like to log the exception to somewhere (network or lcd) and not just freeze.
Catch all exceptions, what exception was raised?
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Catch all exceptions, what exception was raised?
Code: Select all
paste mode; Ctrl-C to cancel, Ctrl-D to finish
=== try:
=== 1/0
=== except Exception as e:
=== print(e)
===
division by zero
>>>
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.