mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Only reset the server error if there was an error to raise - fix race condition
This commit is contained in:
parent
41542d5617
commit
866c975076
1 changed files with 6 additions and 4 deletions
|
@ -123,17 +123,19 @@ module Capybara
|
||||||
# Raise errors encountered in the server
|
# Raise errors encountered in the server
|
||||||
#
|
#
|
||||||
def raise_server_error!
|
def raise_server_error!
|
||||||
if Capybara.raise_server_errors and @server and @server.error
|
if @server and @server.error
|
||||||
# Force an explanation for the error being raised as the exception cause
|
# Force an explanation for the error being raised as the exception cause
|
||||||
begin
|
begin
|
||||||
raise CapybaraError, "Your application server raised an error - It has been raised in your test code because Capybara.raise_server_errors == true"
|
if Capybara.raise_server_errors
|
||||||
|
raise CapybaraError, "Your application server raised an error - It has been raised in your test code because Capybara.raise_server_errors == true"
|
||||||
|
end
|
||||||
rescue CapybaraError
|
rescue CapybaraError
|
||||||
#needed to get the cause set correctly in JRuby -- otherwise we could just do raise @server.error
|
#needed to get the cause set correctly in JRuby -- otherwise we could just do raise @server.error
|
||||||
raise @server.error, @server.error.message, @server.error.backtrace
|
raise @server.error, @server.error.message, @server.error.backtrace
|
||||||
|
ensure
|
||||||
|
@server.reset_error!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
ensure
|
|
||||||
@server.reset_error! if @server
|
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
Loading…
Reference in a new issue