Skip to content

Fix exception: NoMethodError: "undefined method `status' for #<Faraday::TimeoutError:...>"#81

Open
kapcod wants to merge 1 commit into
mhenrixon:masterfrom
kapcod:patch-1
Open

Fix exception: NoMethodError: "undefined method `status' for #<Faraday::TimeoutError:...>"#81
kapcod wants to merge 1 commit into
mhenrixon:masterfrom
kapcod:patch-1

Conversation

@kapcod

@kapcod kapcod commented May 18, 2021

Copy link
Copy Markdown

Somehow Faraday::TimeoutError object is passed as response parameter. In this case it doesn't have status or body, but the request url/headers still matter.
Probably the bug is in a different place that passes the invalid response parameter, but even if that bug will be found and fixed, this change can stay as a failsafe.

…y::TimeoutError:...>"

Somehow Faraday::TimeoutError object is passed as `response` parameter. In this case it doesn't have status or body, but the request url/headers still matter.
Probably the bug is in a different place that passes the invalid `response` parameter, but even if that bug will be found and fixed, this change can stay as a failsafe.
URL: #{env.url}
REQUEST HEADERS: #{env.request_headers}
RESPONSE_HEADERS: #{env.response_headers}
REQUEST_BODY: #{env.request_body}\n\n"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ActiveCampaign::Error#message calls 'env.request_body' 2 times

<<~MESSAGE
ERROR: #{response.class.name}: #{response}
URL: #{env.url}
REQUEST HEADERS: #{env.request_headers}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ActiveCampaign::Error#message calls 'env.request_headers' 2 times

ERROR: #{response.class.name}: #{response}
URL: #{env.url}
REQUEST HEADERS: #{env.request_headers}
RESPONSE_HEADERS: #{env.response_headers}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ActiveCampaign::Error#message calls 'env.response_headers' 2 times

elsif response.is_a?(Exception)
<<~MESSAGE
ERROR: #{response.class.name}: #{response}
URL: #{env.url}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ActiveCampaign::Error#message calls 'env.url' 2 times

URL: #{env.url}
REQUEST HEADERS: #{env.request_headers}
RESPONSE_HEADERS: #{env.response_headers}
REQUEST_BODY: #{env.request_body}\n\n"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ActiveCampaign::Error#message calls 'env.request_body' 2 times

@qlty-cloud-legacy

Copy link
Copy Markdown

Code Climate has analyzed commit 4950836 and detected 9 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 9

View more on Code Climate.

@reinaris

Copy link
Copy Markdown

+1 any possibility to merge this @mhenrixon?

def message
if response.nil?
super
elsif response.is_a?(Exception)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to be a little more specific?

Also, there are a bunch of duplication now that code climate warns about. Would it perhaps make sense to address that? I am hesitant to merge something that doesn't pass the rubocop style guide.

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

Successfully merging this pull request may close these issues.

3 participants