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

What's the best way to provide extra_context for all Faraday::Error::ClientError? #814

Closed
dblock opened this issue Feb 9, 2018 · 5 comments

Comments

@dblock
Copy link

dblock commented Feb 9, 2018

Coming from artsy/doppler#136. Somewhere a Rails controller throws a Faraday::Error::ClientError. That gets logged with a generic to_s like "The server returned 400". We want the body of that response in Sentry.

What's the best way to accomplish that (customize what gets reported per type of StandardError) generically in a Rails app?

@nateberkopec
Copy link
Contributor

Hiya @dblock!

The rescue_from block you posted in your issue there would work fine. You also sound like you might like this:

class Faraday::Error::ClientError
  def raven_context
    { :extra => { :response => response } } 
  end
end

See here.

@isaacseymour
Copy link

@nateberkopec would you be open to a PR doing this monkey-patching when this gem loads? Since sentry-raven depends on Faraday anyway, it seems helpful to add this context out-of-the-box to me.

@dblock
Copy link
Author

dblock commented Jul 18, 2019

+1 to what @isaacseymour is saying

@nateberkopec
Copy link
Contributor

nateberkopec commented Jul 18, 2019

Hi, I don't maintain this anymore. Someone else does! I should probably remove my own owner status on rubygems.org too! 😅

@st0012 st0012 added the wontfix label Apr 28, 2021
@st0012
Copy link
Collaborator

st0012 commented Apr 28, 2021

sentry-raven is now in maintenance mode, so we won't introduce such change to it.
The new sentry-ruby doesn't support exception context anymore and we're planning to drop faraday soon. So we won't add the patch to it either 🙂

@st0012 st0012 closed this as completed Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants