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

fix: JSON loading logs #30138

Merged
merged 1 commit into from
Sep 3, 2024
Merged
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
22 changes: 11 additions & 11 deletions superset/utils/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,11 @@ def validate_json(obj: Union[bytes, bytearray, str]) -> None:
:param obj: an object that should be parseable to JSON
"""
if obj:
loads(obj)
try:
loads(obj)
except JSONDecodeError as ex:
logger.error("JSON is not valid %s", str(ex), exc_info=True)
raise


def dumps( # pylint: disable=too-many-arguments
Expand Down Expand Up @@ -236,16 +240,12 @@ def loads(
:param object_hook: function that will be called to decode objects values
:returns: A Python object deserialized from string
"""
try:
return simplejson.loads(
obj,
encoding=encoding,
allow_nan=allow_nan,
object_hook=object_hook,
)
except JSONDecodeError as ex:
logger.error("JSON is not valid %s", str(ex), exc_info=True)
raise
return simplejson.loads(
obj,
encoding=encoding,
allow_nan=allow_nan,
object_hook=object_hook,
)


def redact_sensitive(
Expand Down
Loading