Description
Two bugs found in src/index.py:
Bug 1: Exception details are silently swallowed
In both handle_sol_balance and handle_token_supply, the except block catches Exception without capturing the error message, making debugging impossible.
Current code:
except Exception:
return Response.new(json.dumps({'balance': None, 'error': 'Internal error'}), ...)
Should be:
except Exception as e:
return Response.new(json.dumps({'balance': None, 'error': str(e)}), ...)
Bug 2: Inconsistent error response field in handle_token_supply
The except block in handle_token_supply returns 'balance': None instead of 'supply': None, which is inconsistent with its success response format.
Proposed Fix
Capture the exception in both handlers and fix the response field key in handle_token_supply.
Steps to Reproduce
Trigger an internal error in either endpoint and observe the response.