Closed pylint-bot closed 8 years ago
Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore?):
Do you have anything in mind? e.g. what kind of changes they will need. It sounds good for me, we'll need to find the proper information type that we need to put into the exceptions.
Original comment by BitBucket: ceridwenv, GitHub: @ceridwen?:
I'd have to study the exceptions to come up with complete ideas, but one basic approach is to take the information that's currently being put in strings, break it out into other attributes of the exception, and then have the exception have some kind of __str__
/__repr__
that returns the formatted string for display in stack traces.
Original comment by BitBucket: ceridwenv, GitHub: @ceridwen?:
e17cea5afccd finishes finishes the structured exceptions patch, adding lazy message generation, handling of keyword arguments to astroid exceptions, and some general improvements to exceptions.
Originally reported by: BitBucket: ceridwenv, GitHub: @ceridwen?
There is a PEP, https://www.python.org/dev/peps/pep-0473/, sadly languishing in obscurity, that proposes making Python exceptions structured rather than the way they are at the moment, where contextual information is included in the message, if at all. For custom exceptions, I don't see any reason not to implement the idea right now, to make it easier to extract information from exceptions and to include more context.