lib/roda/plugins/error_mail.rb in roda-2.29.0 vs lib/roda/plugins/error_mail.rb in roda-3.0.0

- old
+ new

@@ -6,11 +6,11 @@ module RodaPlugins # The error_mail plugin adds an +error_mail+ instance method that # send an email related to the exception. This is most useful if you are # also using the error_handler plugin: # - # plugin :error_mail, :to=>'to@example.com', :from=>'from@example.com' + # plugin :error_mail, to: 'to@example.com', from: 'from@example.com' # plugin :error_handler do |e| # error_mail(e) # 'Internal Server Error' # end # @@ -34,15 +34,12 @@ # # Note that emailing on every error as shown above is only appropriate # for low traffic web applications. For high traffic web applications, # use an error reporting service instead of this plugin. module ErrorMail - OPTS = {}.freeze - RodaPlugins.deprecate_constant(self, :OPTS) - # Set default opts for plugin. See ErrorEmail module RDoc for options. - def self.configure(app, opts=RodaPlugins::OPTS) - app.opts[:error_mail] = email_opts = (app.opts[:error_mail] || RodaPlugins::OPTS).merge(opts).freeze + def self.configure(app, opts=OPTS) + app.opts[:error_mail] = email_opts = (app.opts[:error_mail] || OPTS).merge(opts).freeze unless email_opts[:to] && email_opts[:from] raise RodaError, "must provide :to and :from options to error_mail plugin" end end