Skip to content
Closed
Show file tree
Hide file tree
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
18 changes: 14 additions & 4 deletions server/services/datacommons.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,15 @@ def get(url: str):
response = requests.get(url, headers=headers)
call_logger.finish(response)
if response.status_code != 200:
try:
error_msg = response.json().get("message", "No message")
except Exception:
error_msg = response.text[:1000]
logger.error("Mixer Error %s (%s) for GET %s. Response: %s",
response.status_code, response.reason, url, error_msg)
raise ValueError(
"An HTTP {} code ({}) was returned by the mixer:\n{}".format(
response.status_code, response.reason,
response.json()["message"]))
response.status_code, response.reason, error_msg))
res_json = response.json()
response_id = response.headers.get(MIXER_RESPONSE_ID_HEADER)
# This is used to log cached and uncached mixer usage and is a list to be compatible with other cachable
Expand Down Expand Up @@ -103,10 +108,15 @@ def post_wrapper(url, req_str: str, headers_str: str | None = None):
call_logger.finish(response)

if response.status_code != 200:
try:
error_msg = response.json().get("message", "No message")
except Exception:
error_msg = response.text[:1000]
logger.error("Mixer Error %s (%s) for POST %s. Payload: %s. Response: %s",
response.status_code, response.reason, url, req_str, error_msg)
raise ValueError(
"An HTTP {} code ({}) was returned by the mixer:\n{}".format(
response.status_code, response.reason,
response.json()["message"]))
response.status_code, response.reason, error_msg))
res_json = response.json()
response_id = response.headers.get(MIXER_RESPONSE_ID_HEADER)
# This is used to log cached mixer usage and is a list to be compatible with other cached
Expand Down
4 changes: 3 additions & 1 deletion server/services/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ def get_service_url(endpoint_path: str) -> str:
if endpoint_path not in endpoints.endpoint_paths:
raise InvalidEndpointException('endpoint %s was not configured' %
endpoint_path)
return endpoints.get_service_url(endpoint_path)
service_url = endpoints.get_service_url(endpoint_path)
print(f"DEBUG: get_service_url({endpoint_path}) -> {service_url}")
return service_url


def get_health_check_urls():
Expand Down
Loading