getonbrd / pipedrive-connect

Ruby library for the Pipedrive API.
MIT License
19 stars 30 forks source link

Fix: Error when a deal has no subscription and Pipedrive::Subscription.find_by_deal is called #24

Closed njcameron closed 1 year ago

njcameron commented 1 year ago

Fixes #23

Seems odd that the Pipedrive API doesn't return a nice error like when a deal cannot be found.

Not sure if this is the best way of handling it but the test case reproduces the issue.

j4rs commented 1 year ago

Hey Neil,

Thanks for reporting the issue and also for the suggestion that led me to find out that for some reason the API is returning (in this particular case) the response with HTTP status code 204 and so an empty body.

So inspired by your solution I wrote this on #25. Please check it out and let me know what you think, thanks 🙂 .

j4rs commented 1 year ago

I also added the capability to treat the 204 status code as 404 so a not found exception will be raised 😉. Let me know whether this suits your case.

j4rs commented 1 year ago

Hey Neil, I am closing this one given that #25 does the job.

njcameron commented 1 year ago

Sorry for the radio silence, this looks like a great way of handling it, thanks for the update!