Permalink
Browse files

Extend exception notifier to add non-rails exception types

  • Loading branch information...
1 parent 24feff3 commit 36c72aa5295491cb4ca04e3be9e006d56eb8e9ab @isuda committed Jul 12, 2011
@@ -55,8 +55,16 @@ def exception_notification(env, exception)
instance_variable_set("@#{name}", value)
end
- prefix = "#{@options[:email_prefix]}#{@kontroller.controller_name}##{@kontroller.action_name}"
- subject = "#{prefix} (#{@exception.class}) #{@exception.message.inspect}"
+ if @kontroller.class != MissingController
+ prefix = "#{@options[:email_prefix]}#{@kontroller.controller_name}##{@kontroller.action_name}"
+ else
+ prefix = @options[:email_prefix]
+ end
+ if @message
+ subject = "#{prefix} #{@message}"
+ else
+ subject = "#{prefix} (#{@exception.class}) #{@exception.message.inspect}"
+ end
subject = subject.length > 120 ? subject[0...120] + "..." : subject
mail(:to => @options[:exception_recipients], :from => @options[:sender_address], :subject => subject) do |format|
@@ -0,0 +1,7 @@
+<% max = @params.keys.max { |a, b| a.length <=> b.length } -%>
+<% @params.keys.sort.each do |key| -%>
+* <%= raw("%-*s: %s" % [max.length, key.to_s, inspect_object(@params[key])]) %>
+<% end -%>
+
+* Process: <%= raw $$ %>
+* Server : <%= raw `hostname -s`.chomp %>

0 comments on commit 36c72aa

Please sign in to comment.