From 661ebf30f469d7aae3c5c9696c3c0dcafad8c084 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: May 30 2022 11:57:18 +0000 Subject: frontend: don't mislead users upon error 500 "Request is not in JSON format" sounds like the user did something wrong, while it is clearly a server-side problem. Reported-by: Jiří Popelka --- diff --git a/cli/copr_cli/main.py b/cli/copr_cli/main.py index 467bdb5..5c8b64d 100644 --- a/cli/copr_cli/main.py +++ b/cli/copr_cli/main.py @@ -1773,7 +1773,7 @@ def str2bool(v): def _handle_frontend_api_request_error(e, args): - if "Request is not in JSON format" not in str(e): + if "is not in JSON format" not in str(e): return if not args.debug: sys.stderr.write("Try 'copr-cli --debug' for more info.\n") diff --git a/python/copr/v3/requests.py b/python/copr/v3/requests.py index 4d4dbe1..0988fc0 100644 --- a/python/copr/v3/requests.py +++ b/python/copr/v3/requests.py @@ -147,5 +147,5 @@ def handle_errors(response): # pylint: disable=raise-missing-from raise CoprTimeoutException(message, response=response) - raise CoprRequestException("Request is not in JSON format, there is probably a bug in the API code.", + raise CoprRequestException("Response is not in JSON format, there is probably a bug in the API code.", response=response)