Skip to content

Commit 398a989

Browse files
committed
Do not log xml error responses
1 parent 6355d92 commit 398a989

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

server/mergin/app.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -389,13 +389,16 @@ def handle_exception(e):
389389
def log_bad_request(response):
390390
"""Log bad requests for easier debugging"""
391391
if response.status_code == 400:
392-
json_body = response.get_json(silent=True)
393-
if json_body and json_body.get("detail"):
394-
# default response from connexion (check against swagger.yaml)
395-
logging.warning(f'HTTP 400: {json_body["detail"]}')
392+
if "xml" in response.content_type:
393+
pass # QGIS proxy errors are already logged at the source
396394
else:
397-
# either WTF form validation error or custom validation with abort(400)
398-
logging.warning(f"HTTP 400: {response.data}")
395+
json_body = response.get_json(silent=True)
396+
if json_body and json_body.get("detail"):
397+
# default response from connexion (check against swagger.yaml)
398+
logging.warning(f'HTTP 400: {json_body["detail"]}')
399+
else:
400+
# either WTF form validation error or custom validation with abort(400)
401+
logging.warning(f"HTTP 400: {response.data}")
399402
elif response.status_code == 409:
400403
# request which would result in conflict, e.g. creating the same project again
401404
logging.warning(f"HTTP 409: {response.data}")

0 commit comments

Comments
 (0)