On Fri, May 1, 2020 at 1:24 PM Christopher Barker <python...@gmail.com>
wrote:

> On Fri, May 1, 2020 at 1:38 AM M.-A. Lemburg <m...@egenix.com> wrote:
>
>> Adding more exception types to the stack makes sense when there's
>> a dedicated need to catch only specific sub types, but even there
>> it's already possible to add this extra information to the exception
>> objects as e.g. .errno or similar attribute.
>>
>
> Maybe it's too late for this, but I would love it if ".errno or similar"
> were more standardized. As it is, every exception may have it's own way to
> find out more about exactly what caused it, and often you are left with
> parsing the message if you really want to know.
>
> Honestly, I've never written production code that does that -- but I don't
> think that's because there's no need for it, but because, well, parsing an
> error message is pretty painful, and just seems "wrong".
>
> I'm not sure how this could reasonably work, but maybe we could
> standardize that all Exceptions have an .errno attribute, and a standard
> mapping between the errorno and a message, or, ....
>
>
+100

With the exception of the obscure "SyntaxError: Invalid syntax", this would
make it really easy to provide translations of error messages in other
languages (or in "beginner friendly English") as I'm slowly doing with
friendly-traceback.

André Roberge
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/MN6XX4H76UJZV3UJGHVW4LKTBCAQFXDY/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to