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 exception if API call fails #5

Closed
cmwelsh opened this issue Jan 20, 2015 · 2 comments · Fixed by #6
Closed

Throw exception if API call fails #5

cmwelsh opened this issue Jan 20, 2015 · 2 comments · Fixed by #6
Milestone

Comments

@cmwelsh
Copy link
Contributor

cmwelsh commented Jan 20, 2015

I'm currently getting this error when the API returns unsuccessful response... no way to catch these in my application.

E_WARNING: array_merge(): Argument #2 is not an array
1 File "/public_html/vendor/davidepastore/ipinfo/src/DavidePastore/Ipinfo/Host.php" line 33 in array_merge
2 File "/public_html/vendor/davidepastore/ipinfo/src/DavidePastore/Ipinfo/Host.php" line 33 in __construct
3 File "/public_html/vendor/davidepastore/ipinfo/src/DavidePastore/Ipinfo/Ipinfo.php" line 153 in checkGeo
4 File "/public_html/vendor/davidepastore/ipinfo/src/DavidePastore/Ipinfo/Ipinfo.php" line 125 in getSpecificField
@cmwelsh
Copy link
Contributor Author

cmwelsh commented Jan 20, 2015

Alternatively, you could have it fail silently if you transform an invalid JSON response from the API into an empty object. The issue is passing null into array_merge in the Host constructor.

@DavidePastore
Copy link
Owner

Thanks @cmwelsh ! 🎸

@DavidePastore DavidePastore added this to the v0.1.1 milestone Nov 28, 2016
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 a pull request may close this issue.

2 participants