Skip to content
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
15 changes: 9 additions & 6 deletions server/mergin/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,16 @@ def handle_exception(e):
def log_bad_request(response):
"""Log bad requests for easier debugging"""
if response.status_code == 400:
json_body = response.get_json(silent=True)
if json_body and json_body.get("detail"):
# default response from connexion (check against swagger.yaml)
logging.warning(f'HTTP 400: {json_body["detail"]}')
if "xml" in response.content_type:
pass # QGIS proxy errors are already logged at the source
else:
# either WTF form validation error or custom validation with abort(400)
logging.warning(f"HTTP 400: {response.data}")
json_body = response.get_json(silent=True)
if json_body and json_body.get("detail"):
# default response from connexion (check against swagger.yaml)
logging.warning(f'HTTP 400: {json_body["detail"]}')
else:
# either WTF form validation error or custom validation with abort(400)
logging.warning(f"HTTP 400: {response.data}")
elif response.status_code == 409:
# request which would result in conflict, e.g. creating the same project again
logging.warning(f"HTTP 409: {response.data}")
Expand Down
Loading