From a2671e54c3abfcdc14b95f262d0bb6d016a938ff Mon Sep 17 00:00:00 2001 From: hukl Date: Sat, 31 Oct 2009 18:59:01 +0100 Subject: added exception notifier plugin to catch all exceptions --- .../views/exception_notifier/_backtrace.rhtml | 1 + .../views/exception_notifier/_environment.rhtml | 7 +++++++ .../views/exception_notifier/_inspect_model.rhtml | 16 ++++++++++++++++ .../views/exception_notifier/_request.rhtml | 4 ++++ .../views/exception_notifier/_session.rhtml | 2 ++ .../views/exception_notifier/_title.rhtml | 3 +++ .../exception_notifier/exception_notification.rhtml | 6 ++++++ 7 files changed, 39 insertions(+) create mode 100644 vendor/plugins/exception_notification/views/exception_notifier/_backtrace.rhtml create mode 100644 vendor/plugins/exception_notification/views/exception_notifier/_environment.rhtml create mode 100644 vendor/plugins/exception_notification/views/exception_notifier/_inspect_model.rhtml create mode 100644 vendor/plugins/exception_notification/views/exception_notifier/_request.rhtml create mode 100644 vendor/plugins/exception_notification/views/exception_notifier/_session.rhtml create mode 100644 vendor/plugins/exception_notification/views/exception_notifier/_title.rhtml create mode 100644 vendor/plugins/exception_notification/views/exception_notifier/exception_notification.rhtml (limited to 'vendor/plugins/exception_notification/views') diff --git a/vendor/plugins/exception_notification/views/exception_notifier/_backtrace.rhtml b/vendor/plugins/exception_notification/views/exception_notifier/_backtrace.rhtml new file mode 100644 index 0000000..7d13ba0 --- /dev/null +++ b/vendor/plugins/exception_notification/views/exception_notifier/_backtrace.rhtml @@ -0,0 +1 @@ +<%= @backtrace.join "\n" %> diff --git a/vendor/plugins/exception_notification/views/exception_notifier/_environment.rhtml b/vendor/plugins/exception_notification/views/exception_notifier/_environment.rhtml new file mode 100644 index 0000000..42dd803 --- /dev/null +++ b/vendor/plugins/exception_notification/views/exception_notifier/_environment.rhtml @@ -0,0 +1,7 @@ +<% max = @request.env.keys.max { |a,b| a.length <=> b.length } -%> +<% @request.env.keys.sort.each do |key| -%> +* <%= "%-*s: %s" % [max.length, key, filter_sensitive_post_data_from_env(key, @request.env[key].to_s.strip)] %> +<% end -%> + +* Process: <%= $$ %> +* Server : <%= `hostname -s`.chomp %> diff --git a/vendor/plugins/exception_notification/views/exception_notifier/_inspect_model.rhtml b/vendor/plugins/exception_notification/views/exception_notifier/_inspect_model.rhtml new file mode 100644 index 0000000..e817847 --- /dev/null +++ b/vendor/plugins/exception_notification/views/exception_notifier/_inspect_model.rhtml @@ -0,0 +1,16 @@ +<% if show_attributes -%> +[attributes] +<% attrs = inspect_model.attributes -%> +<% max = attrs.keys.max { |a,b| a.length <=> b.length } -%> +<% attrs.keys.sort.each do |attr| -%> +* <%= "%*-s: %s" % [max.length, attr, object_to_yaml(attrs[attr]).gsub(/\n/, "\n ").strip] %> +<% end -%> +<% end -%> + +<% if show_instance_variables -%> +[instance variables] +<% inspect_model.instance_variables.sort.each do |variable| -%> +<%- next if variable == "@attributes" -%> +* <%= variable %>: <%= inspect_value(inspect_model.instance_variable_get(variable)) %> +<% end -%> +<% end -%> diff --git a/vendor/plugins/exception_notification/views/exception_notifier/_request.rhtml b/vendor/plugins/exception_notification/views/exception_notifier/_request.rhtml new file mode 100644 index 0000000..2542309 --- /dev/null +++ b/vendor/plugins/exception_notification/views/exception_notifier/_request.rhtml @@ -0,0 +1,4 @@ +* URL : <%= @request.protocol %><%= @host %><%= @request.request_uri %> +* IP address: <%= @request.env["HTTP_X_FORWARDED_FOR"] || @request.env["REMOTE_ADDR"] %> +* Parameters: <%= filter_sensitive_post_data_parameters(@request.parameters).inspect %> +* Rails root: <%= @rails_root %> diff --git a/vendor/plugins/exception_notification/views/exception_notifier/_session.rhtml b/vendor/plugins/exception_notification/views/exception_notifier/_session.rhtml new file mode 100644 index 0000000..283c862 --- /dev/null +++ b/vendor/plugins/exception_notification/views/exception_notifier/_session.rhtml @@ -0,0 +1,2 @@ +* session id: <%= @request.session.instance_variable_get(:@session_id).inspect %> +* data: <%= PP.pp(@request.session.instance_variable_get(:@data),"").gsub(/\n/, "\n ").strip %> diff --git a/vendor/plugins/exception_notification/views/exception_notifier/_title.rhtml b/vendor/plugins/exception_notification/views/exception_notifier/_title.rhtml new file mode 100644 index 0000000..1ed5a3f --- /dev/null +++ b/vendor/plugins/exception_notification/views/exception_notifier/_title.rhtml @@ -0,0 +1,3 @@ +------------------------------- +<%= title.to_s.humanize %>: +------------------------------- diff --git a/vendor/plugins/exception_notification/views/exception_notifier/exception_notification.rhtml b/vendor/plugins/exception_notification/views/exception_notifier/exception_notification.rhtml new file mode 100644 index 0000000..ec30c4a --- /dev/null +++ b/vendor/plugins/exception_notification/views/exception_notifier/exception_notification.rhtml @@ -0,0 +1,6 @@ +A <%= @exception.class %> occurred in <%= @controller.controller_name %>#<%= @controller.action_name %>: + + <%= @exception.message %> + <%= @backtrace.first %> + +<%= @sections.map { |section| render_section(section) }.join %> -- cgit v1.3