Message380013
Printing an exception is defined as printing the exception message, which currently is e.args[0]. We will not change that as it would break code worldwide. To print more, the class name can be used directly or as a key into a dict of replacements or replacement functions.
Questions and vague ideas should be directed to python-list. Fleshed out ideas can go to python-ideas.
>>> {}['d']
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
{}['d']
KeyError: 'd'
>>> try:
{}['d']
except Exception as e:
print(e)
'd'
>>> try:
{}['d']
except Exception as e:
print(e.args)
('d',)
>>> try:
{}['d']
except Exception as e:
print(f'{e.__class__.__name__}: {e}') # Reproduce standard report.
KeyError: 'd' |
|
Date |
User |
Action |
Args |
2020-10-30 23:35:37 | terry.reedy | set | recipients:
+ terry.reedy, zingero |
2020-10-30 23:35:37 | terry.reedy | set | messageid: <1604100937.95.0.201297081075.issue42177@roundup.psfhosted.org> |
2020-10-30 23:35:37 | terry.reedy | link | issue42177 messages |
2020-10-30 23:35:37 | terry.reedy | create | |
|