diff options
author | Mark Longair <mhl@pobox.com> | 2013-05-02 15:34:08 +0100 |
---|---|---|
committer | Mark Longair <mhl@pobox.com> | 2013-05-16 09:06:27 +0100 |
commit | 2805cc72a21089ea9725352b1d4d39d7d929a7a0 (patch) | |
tree | 91548ee398fa91532afcaa1dd1536b9516871740 /lib/mail_handler/mail_handler.rb | |
parent | ec414d4dcb0c027be6c59ce873127dc10037dc50 (diff) |
Ignore common TNEF attachment parsing errors
This also introduces a custom error class so that we don't
accidentally catch other problems.
Fixes #920
Diffstat (limited to 'lib/mail_handler/mail_handler.rb')
-rw-r--r-- | lib/mail_handler/mail_handler.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/mail_handler/mail_handler.rb b/lib/mail_handler/mail_handler.rb index e5c6b1087..4d942768b 100644 --- a/lib/mail_handler/mail_handler.rb +++ b/lib/mail_handler/mail_handler.rb @@ -8,6 +8,9 @@ module MailHandler require 'backends/mail_backend' include Backends::MailBackend + class TNEFParsingError < StandardError + end + # Returns a set of attachments from the given TNEF contents # The TNEF contents also contains the message body, but in general this is the # same as the message body in the message proper. @@ -21,7 +24,7 @@ module MailHandler raise IOError, "tnef exited with signal #{$?.termsig}" end if $?.exited? && $?.exitstatus != 0 - raise IOError, "tnef exited with status #{$?.exitstatus}" + raise TNEFParsingError, "tnef exited with status #{$?.exitstatus}" end end found = 0 @@ -34,7 +37,7 @@ module MailHandler end end if found == 0 - raise IOError, "tnef produced no attachments" + raise TNEFParsingError, "tnef produced no attachments" end end attachments |