Skip to content

Commit

Permalink
Handle empty API proxy responses (#38)
Browse files Browse the repository at this point in the history
# Description
Set default values in `validate_api_proxy_response` to include more
details in error responses to clients

# Issues
Addresses uncaught exception logged in
https://neon-ai.sentry.io/issues/6302853101/events/fefd6b7410644e9bacab910f6349bd00/

# Other Notes
Deployed and tested in the `alpha` namespace
  • Loading branch information
NeonDaniel authored Feb 18, 2025
1 parent 322514a commit 30a063d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions neon_hana/mq_service_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ def __init__(self, config: dict):

@staticmethod
def _validate_api_proxy_response(response: dict, query_params: dict):
response.setdefault('content',
{"error": "No response content was received",
"raw_response": response,
"raw_query": query_params})
response.setdefault('status_code', 500)
if response['status_code'] == 200:
try:
resp = json.loads(response['content'])
Expand Down

0 comments on commit 30a063d

Please sign in to comment.