From c842211e758ea7a7a494577b860f025dfda3a2e3 Mon Sep 17 00:00:00 2001 From: Guillaume DOTT Date: Mon, 10 Feb 2014 11:15:13 +0100 Subject: [PATCH] Add SMS ID to MalformedSms error --- lib/biju/hayes.rb | 2 +- lib/biju/pdu/errors.rb | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/biju/hayes.rb b/lib/biju/hayes.rb index c5cc9e6..191954d 100644 --- a/lib/biju/hayes.rb +++ b/lib/biju/hayes.rb @@ -105,7 +105,7 @@ module Biju begin Biju::Sms.from_pdu(msg[:message].chomp, msg[:infos][0]) rescue Biju::PDU::Errors::PDUError => e - malformed = Biju::PDU::Errors::MalformedSms.new(msg[:message].chomp, e) + malformed = Biju::PDU::Errors::MalformedSms.new(msg[:message].chomp, msg[:infos][0], e) if exceptions raise malformed else diff --git a/lib/biju/pdu/errors.rb b/lib/biju/pdu/errors.rb index 37fe0cf..3824678 100644 --- a/lib/biju/pdu/errors.rb +++ b/lib/biju/pdu/errors.rb @@ -6,9 +6,10 @@ module Biju class MalformedSms < PDUError attr_reader :original_exception - attr_reader :pdu + attr_reader :pdu, :id - def initialize(pdu, original_exception = nil) + def initialize(pdu, id, original_exception = nil) + @id = id @pdu = pdu @original_exception = original_exception end