Skip to content

Commit

Permalink
Keep original exception and backtrace
Browse files Browse the repository at this point in the history
  • Loading branch information
Clemens Kofler committed Nov 19, 2015
1 parent ed18a7e commit e8e588d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/capybara/slow_finder_errors.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'capybara'
module Capybara
class SlowFinderError < CapybaraError; end
ADDITIONAL_MESSAGE = 'Timeout reached while running a *waiting* Capybara finder...perhaps you wanted to return immediately? Use a non-waiting Capybara finder. More info: http://blog.codeship.com/faster-rails-tests?utm_source=gem_exception'

module Node
class Base
Expand All @@ -9,10 +9,9 @@ def synchronize_with_timeout_error(*args, &block)
synchronize_without_timeout_error(*args, &block)
rescue Capybara::ElementNotFound => e
seconds = args.first || Capybara.default_max_wait_time
if seconds > 0 && Time.now-start_time > seconds
raise SlowFinderError, "Timeout reached while running a *waiting* Capybara finder...perhaps you wanted to return immediately? Use a non-waiting Capybara finder. More info: http://blog.codeship.com/faster-rails-tests?utm_source=gem_exception"
end
raise
raise e unless seconds > 0 && Time.now-start_time > seconds

raise e, "#{$!}\n\n#{ADDITIONAL_MESSAGE}", e.backtrace
end
alias_method :synchronize_without_timeout_error, :synchronize
alias_method :synchronize, :synchronize_with_timeout_error
Expand Down

0 comments on commit e8e588d

Please sign in to comment.