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

Don't obscure the original Mechanize error #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 14 additions & 16 deletions lib/capybara/mechanize/browser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,26 +99,24 @@ def process_remote_request(method, url, attributes, headers)
url = uri.to_s

reset_cache!
begin
if method == :post
if attributes.is_a? Mechanize::Form
submit_mechanize_form(url, attributes, headers)
else
@agent.send(method, url, attributes, headers)
end
elsif method == :get
if attributes.is_a? Mechanize::Form
submit_mechanize_form(url, attributes, headers)
else
referer = headers['HTTP_REFERER']
@agent.send(method, url, attributes, referer, headers)
end

if method == :post
if attributes.is_a? Mechanize::Form
submit_mechanize_form(url, attributes, headers)
else
@agent.send(method, url, attributes, headers)
end
rescue => e
raise "Received the following error for a #{method.to_s.upcase} request to #{url}: '#{e.message}'"
elsif method == :get
if attributes.is_a? Mechanize::Form
submit_mechanize_form(url, attributes, headers)
else
referer = headers['HTTP_REFERER']
@agent.send(method, url, attributes, referer, headers)
end
else
@agent.send(method, url, attributes, headers)
end

@last_request_remote = true
end
end
Expand Down