heroku / heroku/platform-api

Add extra data to exceptions

Open
#74 2 comments 3 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
216
Forks
85
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.