Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle json decode error when there's no json response (e.g. on 403) #203

Merged
merged 2 commits into from
Mar 10, 2024

Conversation

J0
Copy link
Collaborator

@J0 J0 commented Mar 10, 2024

What kind of change does this PR introduce?

Seeks to fix supabase/supabase-py#721

We should probably add better error handling at some point - went with a minimal fix for now

@J0 J0 changed the title fix: handle json decode error fix: handle json decode error when there's no payload (e.g. on 403) Mar 10, 2024
@J0 J0 changed the title fix: handle json decode error when there's no payload (e.g. on 403) fix: handle json decode error when there's no json response (e.g. on 403) Mar 10, 2024
resp = response.json()
raise StorageException({**resp, "statusCode": response.status_code})
except JSONDecodeError:
raise StorageException({"statusCode": response.status_code})
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considered adding

"error": "unknown error occurred"

but didn't want to put in a field here just yet. Prefer to revisit on Mon but also open to suggestions if anyone has ideas on how best to return this error

@J0 J0 merged commit cce5ad4 into main Mar 10, 2024
7 checks passed
@J0 J0 deleted the j0/handle_json_decode_error branch March 10, 2024 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Storage download failing due to JSON decode
1 participant