Module: MerbExceptions::ControllerExtensions
- Defined in:
- lib/merb_exceptions/controller_extensions.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(mod) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/merb_exceptions/controller_extensions.rb', line 4 def self.included(mod) mod.class_eval do def internal_server_error # These two variables are required by the default exception template @exception = self.params[:exception] @exception_name = @exception.name.split("_").map {|x| x.capitalize}.join(" ") self.render_and_notify :layout=>false end end end |
Instance Method Details
#notify_of_exceptions ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/merb_exceptions/controller_extensions.rb', line 20 def notify_of_exceptions exception = self.params[:exception] request = self.request orig_params = self.params[:original_params] details = {} details['exception'] = exception details['params'] = orig_params details['environment'] = request.env.merge( 'process' => $$ ) details['url'] = "#{request.protocol}#{request.env["HTTP_HOST"]}#{request.uri}" MerbExceptions::Notification.new(details).deliver! end |
#render_and_notify(opts = {}) ⇒ Object
16 17 18 |
# File 'lib/merb_exceptions/controller_extensions.rb', line 16 def render_and_notify(opts={}) self.render_then_call(render(opts)) { notify_of_exceptions } end |