Created
September 30, 2011 15:39
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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