Skip to content
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

Include the captured exception on invalid JSON #1454

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bottle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1277,8 +1277,8 @@ def json(self):
return None
try:
return json_loads(b)
except (ValueError, TypeError):
raise HTTPError(400, 'Invalid JSON')
except (ValueError, TypeError) as err:
raise HTTPError(400, 'Invalid JSON', exception=err)
return None

def _iter_body(self, read, bufsize):
Expand Down
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Release 0.14 (in development)
.. rubric:: Removed APIs (deprecated since 0.13)

* Removed the ``RouteReset`` exception and associated logic.
* ``bottle.HTTPError``\s raised on Invalid JSON now include the underlying exception
in their ``exception`` field.

Release 0.13
==============
Expand Down