-
Notifications
You must be signed in to change notification settings - Fork 73
Description
We just encountered this regression after upgrading from version 1.0 to version 3.0 of the Shippo gem/API. It looks like this was really introduced in version 2.0* and we can work around it, but it's still worth noting that the behavior is unexpected and different than Shippo clients in other languages.
Previously, invalid transactions sent to Shippo::Manifest.create were returned in the message body of a Shippo::APIError object. Now, however, a manifest request with invalid transactions results yields an underlying RestClient::NotFound exception, which is wrapped by a Shippo::Exceptions::ConnectionError here:
| rescue ::RestClient::Exception => e |
It looks like at least the PHP and Java clients treat 404s as invalid requests; see
https://github.com/goshippo/shippo-php-client/blob/master/lib/Shippo/ApiRequestor.php#L102 and https://github.com/goshippo/shippo-java-client/blob/5ee5e3068742640cc827d23ab709a5b364c8b613/src/main/java/com/shippo/net/APIResource.java#L522.
Can we we also include NotFound with the BadRequest logic here? https://github.com/goshippo/shippo-ruby-client/blob/master/lib/shippo/api/request.rb#L72
*The fallback exception class changed to ConnectionError in 2.0 (https://github.com/goshippo/shippo-ruby-client/blob/v2.0/lib/shippo/api/request.rb#L64), and the error message is no longer passed through as it was in 1.0. (https://github.com/goshippo/shippo-ruby-client/blob/v1.0.4/lib/shippo.rb#L88)