johannez / chargify

PHP library to interact with the Chargify API
MIT License
5 stars 7 forks source link

Fail gracefully when Customer resource not found #4

Open fakepop opened 9 years ago

fakepop commented 9 years ago

Currently, when I send a GET request to https://[@subdomain].chargify.com/customers/lookup.json?reference=7890, Guzzle throws an exeption.

This prevents from checking whether a customer with a given reference exists or not.

johannez commented 9 years ago

The Chargify does the right thing and sends a 404, which Guzzle then forces to throw the exception. In your code you have to put a try/catch around it and to handle that exception. However, I can also put that into all getters and just return null. I'll look into that.