I have a script that uses the digi.xbee.devices library.
The script receives data from another xbee(radio) device and outputs it to the terminal. The script that does this is called main.py
My issue/question is:
Sometimes I receive a malformed packet and an exception is raised in another file (one of the library files we will call it file2.py).
The exception:
except InvalidPacketException as e:
self._log.error("Error processing packet")
continue
This simply produces the string "Error processing packet" in my terminal.
Is there a way I can access this exception when it triggers? I want to perform something specific when its hits without modifying the library file that raises the exception.
I was hoping I could access whatever the self._log.error is and just search to see if it contains the word "Error".