Open schneems opened 7 years ago
When Excon get's an unexpected return value, can we add the ability to put the response in the error message. Currently it looks like this:
Excon::Error::UnprocessableEntity: Expected([200, 201, 202, 204, 206, 304]) <=> Actual(422 Unprocessable Entity) /Users/schneems/.gem/ruby/2.4.1/gems/excon-0.55.0/lib/excon/middlewares/expects.rb:7:in `response_call' /Users/schneems/.gem/ruby/2.4.1/gems/excon-0.55.0/lib/excon/middlewares/response_parser.rb:9:in `response_call' /Users/schneems/.gem/ruby/2.4.1/gems/excon-0.55.0/lib/excon/connection.rb:388:in `response' /Users/schneems/.gem/ruby/2.4.1/gems/excon-0.55.0/lib/excon/connection.rb:252:in `request' /Users/schneems/.gem/ruby/2.4.1/gems/heroics-0.0.22/lib/heroics/link.rb:111:in `request_with_cache' /Users/schneems/.gem/ruby/2.4.1/gems/heroics-0.0.22/lib/heroics/link.rb:66:in `run' /Users/schneems/.gem/ruby/2.4.1/gems/heroics-0.0.22/lib/heroics/resource.rb:28:in `method_missing' /Users/schneems/.gem/ruby/2.4.1/gems/platform-api-2.0.0/lib/platform-api/client.rb:1231:in `update' /Users/schneems/Documents/projects/hatchet/lib/hatchet/app.rb:50:in `block in set_config'
It's impossible to know if it's due to throttling, or a bad json format on my side without drinking from the EXCON_DEBUG firehose.
In this case my issue was
:body => "{\"id\":\"invalid_params\",\"message\":\"Cannot destroy last attachment to billing app for resource postgresql-silhouetted-85198\"}"
But you have to know a lot about the internals of platform-api to get that.
platform-api
Excon: add extra data to exceptions
Is this done already? What's recommended way to handle this kind of issues? https://stackoverflow.com/q/49022441/1755300
BTW, there's a way to parse the error: https://github.com/heroku/platform-api/issues/50
When Excon get's an unexpected return value, can we add the ability to put the response in the error message. Currently it looks like this:
It's impossible to know if it's due to throttling, or a bad json format on my side without drinking from the EXCON_DEBUG firehose.
In this case my issue was
But you have to know a lot about the internals of
platform-api
to get that.