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 better exceptions for api_usage_exceeded error #13

Open
yoannisj opened this issue Oct 26, 2022 · 1 comment
Open

Throw better exceptions for api_usage_exceeded error #13

yoannisj opened this issue Oct 26, 2022 · 1 comment

Comments

@yoannisj
Copy link

The coconut API returns a 403 HTTP status code when the usage limit is exceeded. This throws a genericCoconut\Error, which does not provide much information to the php code using this library.

Ideally, the error message and error code would be part of the exception thrown so it can be displayed to the end user, or the exception can be handled differently (for example: retrying the API call after a delay?).

@yoannisj
Copy link
Author

The following line should probably check for http status codes between 400 and 403:

https://github.com/opencoconut/coconutphp/blob/master/src/API.php#L35

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

No branches or pull requests

1 participant