Skip to content

Commit

Permalink
fix: JSON loading logs (apache#30138)
Browse files Browse the repository at this point in the history
(cherry picked from commit 5c5b4d0)
  • Loading branch information
michael-s-molina authored and sadpandajoe committed Sep 3, 2024
1 parent 8d7ceeb commit 0f32116
Showing 1 changed file with 11 additions and 11 deletions.
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 @@ -243,16 +247,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

0 comments on commit 0f32116

Please sign in to comment.