From bf0ccd4193499e38605d2834e17363b4f00d8967 Mon Sep 17 00:00:00 2001 From: aamine Date: Fri, 9 Jun 2000 07:53:59 +0000 Subject: o protocol.rb: ProtocolError can take data o http.rb: raise exception with response git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/net/protocol.rb | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'lib/net/protocol.rb') diff --git a/lib/net/protocol.rb b/lib/net/protocol.rb index 02a469cc0..01b659f72 100644 --- a/lib/net/protocol.rb +++ b/lib/net/protocol.rb @@ -68,7 +68,7 @@ Object class Protocol - Version = '1.1.20' + Version = '1.1.21' class << self @@ -295,8 +295,8 @@ Object attr_reader :code_type, :code, :message alias msg message - def error! - raise @code_type.error_type, @code + ' ' + Net.quote(@message) + def error!( data = nil ) + raise code_type.error_type.new( code + ' ' + Net.quote(msg), data ) end end @@ -312,6 +312,17 @@ Object class ProtoRetriableError < ProtocolError; end ProtocRetryError = ProtoRetriableError + class ProtocolError + + def initialize( msg, data ) + super msg + @data = data + end + + attr :data + + end + class Code -- cgit