Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extra data to exceptions #74

Open
schneems opened this issue Jun 16, 2017 · 2 comments
Open

Add extra data to exceptions #74

schneems opened this issue Jun 16, 2017 · 2 comments

Comments

@schneems
Copy link
Contributor

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.

@garyposter
Copy link

@unmultimedio
Copy link

unmultimedio commented Feb 28, 2018

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: #50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants