From 27443066a4a998168255e4e35c8caa4062593878 Mon Sep 17 00:00:00 2001 From: Coleman Date: Sun, 29 Jun 2008 16:19:52 -0500 Subject: [PATCH] adding exception notification support --- app/controllers/exceptions.rb | 6 ++++-- config/init.rb | 4 ++++ config/plugins.yml.template | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 config/plugins.yml.template diff --git a/app/controllers/exceptions.rb b/app/controllers/exceptions.rb index 9456cbb..9b7c6d4 100644 --- a/app/controllers/exceptions.rb +++ b/app/controllers/exceptions.rb @@ -1,15 +1,17 @@ class Exceptions < Application + include MerbExceptions::ControllerExtensions + # handle NotFound exceptions (404) def not_found @page_title = 'Error 404' @secondary_title = 'Document Not Found' - render :format => :html + render_and_notify :format => :html end # handle NotAcceptable exceptions (406) def not_acceptable @page_title = 'Error 500' @secondary_title = 'Application Exception' - render :format => :html + render_and_notify :format => :html end end \ No newline at end of file diff --git a/config/init.rb b/config/init.rb index 9e376b2..e48dcae 100644 --- a/config/init.rb +++ b/config/init.rb @@ -11,6 +11,7 @@ use_orm :activerecord use_test :rspec dependencies 'merb_helpers', 'merb_has_flash', 'merb-mailer' +require 'merb_exceptions' require 'redcloth' require 'RMagick' require 'memcache' @@ -24,4 +25,7 @@ Merb::BootLoader.after_app_loads do memcache_connection_str = 'localhost:11211' end CACHE = MemCache.new memcache_connection_str + + Merb::Mailer.config = { :sendmail_path => '/usr/sbin/sendmail' } + Merb::Mailer.delivery_method = :sendmail end diff --git a/config/plugins.yml.template b/config/plugins.yml.template new file mode 100644 index 0000000..0b65a9a --- /dev/null +++ b/config/plugins.yml.template @@ -0,0 +1,5 @@ +:exceptions: + :app_name: TuxBliki + :email_from: exceptions@penguincoder.org + :email_addresses: + - webmaster@penguincoder.org