On 13.11.13 14:51, nick.coghlan wrote: > http://hg.python.org/cpython/rev/854a2cea31b9 > changeset: 87084:854a2cea31b9 > user: Nick Coghlan <ncoghlan at gmail.com> > date: Wed Nov 13 23:49:21 2013 +1000 > summary: > Close #17828: better handling of codec errors > > - output type errors now redirect users to the type-neutral > convenience functions in the codecs module > - stateless errors that occur during encoding and decoding > will now be automatically wrapped in exceptions that give > the name of the codec involved Wouldn't it be better to add an annotation API to the exceptions classes? This would allow to annotate all exceptions without having to replace the exception object. I.e. BaseException would have an additional method annotate(): try: dostuff(param) except Exception as exc: exc.annotate("while doing stuff with {}".format(param)) annotate() would simply append the message to an internal list attribute. BaseException.__str__() could then use this to format an appropriate exception message. Servus, Walter
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4