Skip to content

Fix incorrect exception reference for json.dumps()#24329

Merged
crazywoola merged 2 commits intolanggenius:mainfrom
hyongtao-code:fix-error
Aug 23, 2025
Merged

Fix incorrect exception reference for json.dumps()#24329
crazywoola merged 2 commits intolanggenius:mainfrom
hyongtao-code:fix-error

Conversation

@hyongtao-code
Copy link
Copy Markdown
Contributor

Fixes: #24328

This PR corrects a misleading exception reference related to Python’s json module.
json.dumps() was previously described as potentially raising json.JSONDecodeError, which is not possible.

json.dumps()

  • Purpose: serialize a Python object into a JSON string.
  • Possible error: TypeError when the object is not JSON-serializable (e.g., contains set, bytes, or unsupported custom objects).
  • It does not raise json.JSONDecodeError.

json.loads()

  • Purpose: deserialize a JSON string into a Python object.
  • Possible error: json.JSONDecodeError when the input string is not valid JSON.

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

Screenshots

Before After
... ...

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. 📚 documentation Improvements or additions to documentation labels Aug 22, 2025
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Aug 22, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 22, 2025
@hyongtao-code
Copy link
Copy Markdown
Contributor Author

Thanks for your review.

@crazywoola crazywoola merged commit 1d09708 into langgenius:main Aug 23, 2025
7 checks passed
qiaofenlin pushed a commit to qiaofenlin/dify that referenced this pull request Aug 24, 2025
Co-authored-by: Yongtao Huang <99629139+hyongtao-db@users.noreply.github.com>
@lyzno1 lyzno1 mentioned this pull request Aug 25, 2025
qiqizjl pushed a commit to qiqizjl/dify that referenced this pull request Aug 27, 2025
Co-authored-by: Yongtao Huang <99629139+hyongtao-db@users.noreply.github.com>
HarryReidx pushed a commit to HarryReidx/dify that referenced this pull request Sep 1, 2025
Co-authored-by: Yongtao Huang <99629139+hyongtao-db@users.noreply.github.com>
(cherry picked from commit 1d09708)
@hyongtao-code hyongtao-code deleted the fix-error branch September 2, 2025 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📚 documentation Improvements or additions to documentation lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Chore] fix incorrect exception reference for json.dumps()

3 participants