Skip to content

Commit

Permalink
Raise a wrapped network error if not threaded
Browse files Browse the repository at this point in the history
  • Loading branch information
gdb committed Jan 18, 2013
1 parent 5e39924 commit 3f89a8d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/bunny/exceptions.rb
Expand Up @@ -136,4 +136,13 @@ class InvalidCommand < ConnectionLevelException

class UnexpectedFrame < ConnectionLevelException
end

class NetworkErrorWrapper < StandardError
attr_reader :other

def initialize(other)
super(other.message)
@other = other
end
end
end
2 changes: 2 additions & 0 deletions lib/bunny/session.rb
Expand Up @@ -309,6 +309,8 @@ def handle_frameset(ch_number, frames)
end

def handle_network_failure(exception)
raise NetworkErrorWrapper.new(exception) unless @threaded

if !recovering_from_network_failure?
@recovering_from_network_failure = true
if recoverable_network_failure?(exception)
Expand Down

0 comments on commit 3f89a8d

Please sign in to comment.