Files

MerbExceptions::ExceptionsHelper

Protected Instance Methods

notify_of_exceptions() click to toggle source

if you need to handle the render yourself for some reason, you can call this method directly. It sends notifications without any rendering logic. Note though that if you are sending lots of notifications this could delay sending a response back to the user so try to avoid using it where possible.

    # File lib/merb-exceptions/exceptions_helper.rb, line 9
 9:     def notify_of_exceptions
10:       if Merb::Plugins.config[:exceptions][:environments].include?(Merb.env)
11:         begin
12:           request = self.request
13: 
14:           details = {}
15:           details['exceptions']  = request.exceptions
16:           details['params']      = params
17:           details['params']      = self.class._filter_params(params)
18:           details['environment'] = request.env.merge( 'process' => $$ )
19:           details['url']         = "#{request.protocol}#{request.env["HTTP_HOST"]}#{request.uri}"
20:           MerbExceptions::Notification.new(details).deliver!
21:         rescue Exception => e
22:           exceptions = request.exceptions << e
23:           Merb.logger.fatal!("Exception Notification Failed:\n" + (exceptions).inspect)
24: 
25:           log_dir = Merb.root / 'log'
26:           unless File.directory?(log_dir)
27:             require 'fileutils'
28:             FileUtils.mkdir_p(log_dir)
29:           end
30: 
31:           File.open(log_dir / 'notification_errors.log', 'a') do |log|
32:             log.puts("Exception Notification Failed:")
33:             exceptions.each do |e|
34:               log.puts(Merb.exception(e))
35:             end
36:           end
37:         end
38:       end
39:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.