Skip to content

Instantly share code, notes, and snippets.

@pedrocunha
Created September 30, 2011 15:39
Show Gist options
  • Save pedrocunha/1254145 to your computer and use it in GitHub Desktop.
Save pedrocunha/1254145 to your computer and use it in GitHub Desktop.
Patch postmark gem to resend emails with exceptions to a error mailing list
module PostmarkNoExceptions
def self.included(base)
base.extend ClassMethods
base.class_eval do
class << self
alias_method_chain :send_through_postmark, :no_exceptions
end
end
end
module ClassMethods
def send_through_postmark_with_no_exceptions(message)
begin
send_through_postmark_without_no_exceptions(message)
rescue Postmark::InvalidMessageError => e
Notifier.deliver_postmark_error(message, e)
end
end
end
end
Postmark.send :include, PostmarkNoExceptions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment