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

How to deal with API errors? #61

Closed
jffluis opened this issue Aug 19, 2024 · 4 comments
Closed

How to deal with API errors? #61

jffluis opened this issue Aug 19, 2024 · 4 comments

Comments

@jffluis
Copy link

jffluis commented Aug 19, 2024

Sometimes API return error 500. Tried try catch with no success since the call is made with a curl in your lib.

@nkl-kst
Copy link
Owner

nkl-kst commented Aug 21, 2024 via email

@jffluis
Copy link
Author

jffluis commented Aug 21, 2024

I just got that error a few times but last week was 5 or 6 times.. Seems random API errors.

I expect to catch the exception and not having the PHP to throw the fault error 500 page.

@nkl-kst
Copy link
Owner

nkl-kst commented Aug 26, 2024

I looked at the code. It checks the HTTP status code and throws a general PHP Exception if it's not 200. We could introduce a more meaningful exception, something like RequestException which can be catched in this case. Would this fix your problem?

@nkl-kst
Copy link
Owner

nkl-kst commented Sep 23, 2024

Closing this issue because of inactivity. Feel free to reopen it.

@nkl-kst nkl-kst closed this as completed Sep 23, 2024
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

2 participants