Skip to content

Commit

Permalink
Use Ruby 2.x compatible rescue clauses
Browse files Browse the repository at this point in the history
Ruby 2.x doesn't support non-class/module arguments to rescue clauses.
Ruby 1.9 only supported it due to what is now considered a regression:

https://bugs.ruby-lang.org/issues/4438

Remove string arguments from rescue clauses to prevent TypeErrors from
being raised during rescue attempts.
  • Loading branch information
ironcladlou committed Apr 22, 2014
1 parent 59f751f commit a4cd737
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/capybara/driver/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def trigger(event)

def inspect
%(#<#{self.class} tag="#{tag_name}" path="#{path}">)
rescue NotSupportedByDriverError, 'Capybara::Driver::Node#inspect'
rescue NotSupportedByDriverError
%(#<#{self.class} tag="#{tag_name}">)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/capybara/node/element.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def reload

def inspect
%(#<Capybara::Element tag="#{tag_name}" path="#{path}">)
rescue NotSupportedByDriverError, 'Capybara::Node::Element#inspect'
rescue NotSupportedByDriverError
%(#<Capybara::Element tag="#{tag_name}">)
end
end
Expand Down

0 comments on commit a4cd737

Please sign in to comment.