Skip to content

Commit

Permalink
Add a comment to explain ::StandardError vs StandardError
Browse files Browse the repository at this point in the history
Change-Id: I631d42dd09163417f260adfb8d3e26c58f604fff
  • Loading branch information
kamaradclimber committed Mar 1, 2017
1 parent ee507fe commit eec4ecd
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions lib/kitchen/driver/ec2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,21 +233,10 @@ def destroy(state)
unless server.nil?
begin
instance.transport.connection(state).close
rescue ::StandardError => ex
rescue ::StandardError => ex # NOTE: using :: is really important as there is another kind of StandardError defined in this context
# We don't care if this fails, and it does so regularly for an
# unknown reason
info("Error closing connection with message: #{ex.class.name} #{ex.message} #{ex.backtrace}")
rescue Exception => ex
info("For an unkwown reason, #{ex.class.name} is not caught as a StandardError")
info(<<-EOH)
Details:
#{ex.inspect}
is a standard error: #{ex.is_a?(StandardError)}
is a standard error: #{ex.is_a?(::StandardError)}
parent class: #{ex.class.superclass.name}
grand parent class: #{ex.class.superclass.superclass.name}
EOH
raise
end
server.terminate
end
Expand Down

0 comments on commit eec4ecd

Please sign in to comment.