Skip to content

Commit

Permalink
be safe with nils in the connection_error handler (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenichi authored and igrigorik committed Nov 22, 2016
1 parent 2cdb359 commit 19d45c8
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions lib/http/2/connection.rb
Expand Up @@ -654,14 +654,9 @@ def connection_error(error = :protocol_error, msg: nil, e: nil)

@state, @error = :closed, error
klass = error.to_s.split('_').map(&:capitalize).join

message = msg
message = e.message if message.nil? && e.respond_to?(:message)

backtrace = []
backtrace = e.backtrace if e.respond_to?(:backtrace)

fail Error.const_get(klass), message, backtrace
msg ||= e && e.message
backtrace = (e && e.backtrace) || []
fail Error.const_get(klass), msg, backtrace
end
end
end

0 comments on commit 19d45c8

Please sign in to comment.