Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Split extra JSON parsing error changes off changes to #14097
Browse files Browse the repository at this point in the history
Split off to, #14097
  • Loading branch information
MadLittleMods committed Oct 7, 2022
1 parent 5eb354a commit e755f41
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions synapse/http/servlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
from twisted.web.server import Request

from synapse.api.errors import Codes, SynapseError
from synapse.http import redact_uri
from synapse.http.server import HttpServer
from synapse.types import JsonDict, RoomAlias, RoomID
from synapse.util import json_decoder
Expand Down Expand Up @@ -665,13 +664,7 @@ def parse_json_value_from_request(
try:
content = json_decoder.decode(content_bytes.decode("utf-8"))
except Exception as e:
logger.warning(
"Unable to parse JSON from %s %s response: %s (%s)",
request.method.decode("ascii", errors="replace"),
redact_uri(request.uri.decode("ascii", errors="replace")),
e,
content_bytes,
)
logger.warning("Unable to parse JSON: %s (%s)", e, content_bytes)
raise SynapseError(
HTTPStatus.BAD_REQUEST, "Content not JSON.", errcode=Codes.NOT_JSON
)
Expand Down

0 comments on commit e755f41

Please sign in to comment.