-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add attributes to tomllib.TOMLDecodeError #126175
Comments
Pinging codeowners @hauntsaninja and @encukou Thoughts on my concern in Discourse about the change breaking TOMLDecodeError init with no arguments would be much appreciated:
|
I would use keywords arguments defaulting to None. Also see PEP-387. |
You can instantiate those errors if you create a custom
Agreed. |
Thanks all for the feedback! I've updated my PoC draft PR in Tomli to be fully backwards compatible. It also adds a deprecation warning for use of positional arguments, which is simple to remove if folks think it's unnecessary. With it I think we could eventually move to the same exact signature that |
Feature or enhancement
Proposal:
Add the same attributes to
tomllib.TOMLDecodeError
thatjson.JSONDecodeError
also has, namely:msg
,doc
,pos
,lineno
,colno
. This will help user facing apps show customized errors to users.This draft PR in Tomli shows the proposed changes.
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Links to previous discussion of this feature:
https://discuss.python.org/t/69546
Linked PRs
__init__
args #126428The text was updated successfully, but these errors were encountered: