FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-122163: Add notes for JSON serialization errors by serhiy-storchaka · Pull Request #122165 · python/cpython · GitHub

/ cpython Public

gh-122163: Add notes for JSON serialization errors - #122165

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:json-encode-notes
Jul 23, 2024
Merged

gh-122163: Add notes for JSON serialization errors#122165
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:json-encode-notes

Conversation

serhiy-storchaka commented Jul 23, 2024
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Member

This allows to identify the source of the error.


📚 Documentation preview 📚: https://cpython-previews--122165.org.readthedocs.build/

This allows to identify the source of the error.

iritkatriel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

serhiy-storchaka merged commit e6b25e9 into python:main Jul 23, 2024
serhiy-storchaka deleted the json-encode-notes branch July 23, 2024 17:02
nohlson pushed a commit to nohlson/cpython that referenced this pull request Jul 24, 2024
nohlson pushed a commit to nohlson/cpython that referenced this pull request Jul 24, 2024

Copy link
Copy Markdown
Contributor

Serhiy, how can I do this in a third party library? _PyErr_FormatNote() is not part of the public API.
Or should I use a different approach? Like creating a JSON path. "/foos/1/bar" and adding it to the error message.

Copy link
Copy Markdown
Member Author

You can do this by implementing your own _PyErr_FormatNote() or like. Create a string object and call the add_note() method of the exception.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL