I wish to collect all the exceptions that occur during execution to generate some statistics.
If for e.g. I run int('abc')
I get an error that says ValueError: invalid literal for int() with base 10: 'abc'
Is there a way where I can get the message invalid literal for int() with base 10:
separately and the offending value separately? Is it possible to get python exceptions as JSON objects or dicts?
Also, I am guessing that there are other text messages for ValueError
. For e.g. float('abc')
yields ValueError : could not convert string to float: 'abc'
. Is it possible to get a list of all possible error messages for an error class?