try except and backtrace print log
Posted: Fri Jan 28, 2022 3:42 am
Hello world ![Smile :-)](./images/smilies/icon_e_smile.gif)
My application catches all Exceptions. I would like to log them and upload to remote server to have insight on the status and possible issues with sensors remotely.
Catching Exception as e and then printing str(e) only gives me the error message. But I would also like to catch the backtrace as it is produced to console without try/except. In Python there is a backtrace module for that, but I cannot find it in a MicroPython. I am sure something like this exist here because backtrace is printed out on error in REPL.
How can I catch and print out the backtrace from an exception in MicroPython?
Any hints welcome![Smile :-)](./images/smilies/icon_e_smile.gif)
![Smile :-)](./images/smilies/icon_e_smile.gif)
My application catches all Exceptions. I would like to log them and upload to remote server to have insight on the status and possible issues with sensors remotely.
Catching Exception as e and then printing str(e) only gives me the error message. But I would also like to catch the backtrace as it is produced to console without try/except. In Python there is a backtrace module for that, but I cannot find it in a MicroPython. I am sure something like this exist here because backtrace is printed out on error in REPL.
How can I catch and print out the backtrace from an exception in MicroPython?
Any hints welcome
![Smile :-)](./images/smilies/icon_e_smile.gif)