lib/marilyn-rpc/mails.rb in marilyn-rpc-0.0.2 vs lib/marilyn-rpc/mails.rb in marilyn-rpc-0.0.3
- old
+ new
@@ -59,15 +59,15 @@
class ExceptionMail < Struct.new(:tag, :exception)
include MarilynRPC::MailHelper
TYPE = MarilynRPC::MailHelper.type(3)
def encode
- TYPE + serialize(self.exception)
+ TYPE + serialize([self.tag, self.exception])
end
def decode(data)
- self.exception = deserialize(only_data(data))
+ self.tag, self.exception = deserialize(only_data(data))
end
end
# Helper to destiguish between the different mails
module MailFactory
@@ -84,10 +84,10 @@
when MarilynRPC::CallResponseMail::TYPE
mail = MarilynRPC::CallResponseMail.new
when MarilynRPC::ExceptionMail::TYPE
mail = MarilynRPC::ExceptionMail.new
else
- raise ArgumentError.new("The passed type #{type.inspect} is unknown!")
+ raise MarilynRPC::BrokenEnvelopeError.new("The passed envelope is broken!")
end
mail.decode(data)
mail
end