getonbrd / pipedrive-connect

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

Provide error_info in error #19

Closed njcameron closed 2 years ago

njcameron commented 2 years ago

Thanks so much for putting this gem together, we've built our whole Pipedrive integration around it.

I have one request: I was debugging a particularly tricky API request and kept receiving the error

<Pipedrive::UnkownAPIError: HTTP request is not valid>

It was only once I did a request directly and I could inspect what I got back did I see:

{"success"=>false, "statusCode"=>10009, "error"=>"HTTP request is not valid", "error_info"=>"Either 'infinite' or 'cyclesCount' must be specified.", "data"=>nil}

Returning this specific error info would be a huge developer experience improvement

j4rs commented 2 years ago

Glad the gem is been useful 🙂, I actually started it - as part of our integration too - imaging it could serve others.

Your suggestion is definitely a good one, I will add a small layer of error handling with better or more explicit error messages.

Thanks for taking the time to suggest such improvement.

njcameron commented 2 years ago

Amazing thanks @j4rs, appreciate it!

j4rs commented 2 years ago

@njcameron Here is the PR #20 - in case you want to check it out before the merge 🙂 - thanks.

njcameron commented 2 years ago

Brilliant, thanks Jorge!