Permalink
Browse files

normalize error initializers

  • Loading branch information...
1 parent eaaaf1b commit d8882f30411ba9fd6fb1165781979574860e176f @mojombo committed Feb 24, 2010
Showing with 6 additions and 2 deletions.
  1. +1 −1 lib/bertrpc/action.rb
  2. +5 −1 lib/bertrpc/errors.rb
View
@@ -57,7 +57,7 @@ def transaction(bert_request)
sock.close
bert_response
rescue Errno::ECONNREFUSED
- raise ConnectionError.new("Unable to connect to #{@svc.host}:#{@svc.port}")
+ raise ConnectionError.new(@svc.host, @svc.port)
rescue Errno::EAGAIN
raise ReadTimeoutError.new(@svc.host, @svc.port, @svc.timeout)
rescue Errno::ECONNRESET
View
@@ -27,7 +27,11 @@ class RemoteError < StandardError
end
class ConnectionError < BERTRPCError
-
+ attr_reader :host, :port
+ def initialize(host, port)
+ @host, @port = host, port
+ super("Unable to connect to #{host}:#{port}")
+ end
end
# Raised when we don't get a response from a server in a timely

0 comments on commit d8882f3

Please sign in to comment.