On 24.06.2017 01:37, MRAB wrote:
I think a "shallow exception" would be one that's part of a defined
API, as distinct from one that is an artifact of the implementation, a
leak in the abstraction.
I like the "shallow exception" idea most. It's simple and it covers most
if not all issues. You also hit the nail with pointing to leaking
abstractions.
It's like when "raise ... from None" was introduced to help in those
cases where you want to replace an exception that's a detail of the
(current) internal implementation with one that's intended for the user.
Regards,
Sven
PS:
This "shallow exception" proposal could help e.g. Django improving their
template system. Here's it's the other way round: the exception handling
is done by Django and depending on the exception it will fall back to a
different attribute access method.
I can remember us implementing such a method which accidentally raised a
caught exception which we then never saw. Debugging this was a mess and
took a quite some time.
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/