-
Notifications
You must be signed in to change notification settings - Fork 980
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
Faraday::Error does not provide original request URL or params #1249
Comments
Great catch @mattbrictson, thanks for reporting this! |
@iMacTia I'm wondering if the Also I suspect So then we would also need a I guess what I am getting at is, would you accept a PR that just adds a |
Good point, I guess
Correct, for POST and other requests that would be the body. In Faraday we usually refer to the query-string as
Absolutely! Either adding the |
I have a similar issue whose fix ideally overlaps somewhat with this one: There should be a way to tell Faraday to never raise an error resulting from a connection (i.e. this should cover all the different timeout errors, socket errors, SSL errors) and instead, in those cases provide the error in the object returned by |
You're right @mvastola, I don't think you can retrieve that at the moment. I don't see a straightforward path to support that to be fair, as that would require changing not only the implementation of the error classes but each adapter as well. I agree this is related in part with this issues, but we can at least add extra information to |
@iMacTia would you like me to open a new issue? |
Either that or a GitHub discussion if you prefer 😄 |
But also, as for a fix, couldn't you just add an option to wrap Faraday's invocation of the adapter in a |
Because of the middleware stack structure, it's not that trivial. Faraday does not directly call the adapter, but injects it at the bottom of the middleware stack when the connection is created. What you could do as a user though, if this use-case is important for you, is to create your own custom middleware that wraps the call to |
Ah, I get it. I guess you can add something that would always be the closest middleware to the adapter. Writing custom middleware we have to maintain would not be preferable for us. It would seem like a better fit for |
Basic Info
Issue description
When the
raise_error
middleware is used, the resultingFaraday::Error
object provides no access to the original request URL that triggered the error. This makes it hard to troubleshoot errors and attribute an error to a problematic URL.Steps to reproduce
Output:
Note that
:params
isnil
, even though I passed"q" => "hello"
as params in the.get
request. Also there is a:url_path
but no full URL that includes the query string.The text was updated successfully, but these errors were encountered: