ref: refs/heads/master
commit e216aabe3e6aef375451c23855c7f5cb06e36017
Author: Ladislav Slezak
Date: Wed Jul 22 10:06:27 2009 +0200
Fixed exception trap rendering
- pass exception to the view (see http://stackoverflow.com/questions/209753/how-do-i-access-assigns-after-rend... for details)
- escape HTML tag in the error message, display it in <pre> (preserve linebreaks)
---
.../app/controllers/application_controller.rb | 3 +--
webclient/app/views/shared/exception_trap.html.erb | 4 ++--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/webclient/app/controllers/application_controller.rb b/webclient/app/controllers/application_controller.rb
index 8ba474f..3d208e1 100644
--- a/webclient/app/controllers/application_controller.rb
+++ b/webclient/app/controllers/application_controller.rb
@@ -23,9 +23,8 @@ class ApplicationController < ActionController::Base
def exception_trap(e)
logger.error "***" + e.to_s
- @error = e
#render :text => "I am sorry"
- render :template => "shared/exception_trap"
+ render :template => "shared/exception_trap", :locals => {:error => e}
return
end
diff --git a/webclient/app/views/shared/exception_trap.html.erb b/webclient/app/views/shared/exception_trap.html.erb
index 97d8b82..cb673fd 100644
--- a/webclient/app/views/shared/exception_trap.html.erb
+++ b/webclient/app/views/shared/exception_trap.html.erb
@@ -11,14 +11,14 @@ $(document).ready(function() {
<h2>Error Message:</h2>
-<p><%= @error.to_s %></p>
+<p><pre><%= h error.to_s %></pre></p>
<p>Please <a href="https://bugzilla.novell.com/enter_bug.cgi?classification=7340&product=openSUSE+11.2&submit=Use+This+Product&component=WebYaST&format=guided">Report a bug so we can fix the problem!.</a> Don't forget to include the bug details.</p>
<a href="#" id="details-link">Show details...</a>
<pre id="backtrace" style="display: none">
-<%= @error.backtrace.blank? ? @error.backtrace.join("\n") : "No information available" %>
+<%= (error.nil? || error.backtrace.nil? || error.backtrace.blank?) ? "No information available" : error.backtrace.join("\n") %>
</pre>
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org