Dwolla Error Handling

If the response from the API is not a 200 or 201 or something in the OK range, will the response raise an exception by default? I am using the ruby sdk and in a class I’m writing I have an if block checking the status of the response as well as a couple rescue blocks to catch ValidationErrors and other unexpected errors. I’m noticing, though, that whenever the response is not OK, it raises an exception. Is this accurate?

Hey @rogerm89,

Yup. Anything 4xx or above will throw an exception. It sounds like you’re on the right track, but here’s a link to a list of possible errors/exceptions as well as some example code.

Let us know if you have any other questions!

2 Likes