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

throw proper error instead of json parse error #441

Merged
merged 3 commits into from
Mar 13, 2024

Conversation

ihlokalise
Copy link
Contributor

Summary

Lokalise can return HTTP 429 Too many requests status due its rate limiter. When this happens await response.json() is unable to parse since its not getting json text and its throwing error Unexpected token '<', "<html>\r\n<h"... is not valid JSON.

When json parse fails sdk should return response status message and status code in order to better handle thrown error.

@ihlokalise ihlokalise requested a review from kibertoad March 13, 2024 09:36
@ihlokalise ihlokalise self-assigned this Mar 13, 2024
@bodrovis
Copy link
Collaborator

Thank you, I'll fix the tests.

@bodrovis bodrovis merged commit 5dca3c1 into lokalise:master Mar 13, 2024
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants