ref: refs/heads/master
commit 5d49831b1f3d158bbea185943424b2d5d3f3a2ac
Author: Duncan Mac-Vicar P
Date: Wed Jul 15 17:17:28 2009 +0200
First version of global exception handling with small bugzilla
integration, more coming.
---
.../app/controllers/application_controller.rb | 9 ++++++
webclient/app/views/shared/exception_trap.html.erb | 27 ++++++++++++++++++++
2 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/webclient/app/controllers/application_controller.rb b/webclient/app/controllers/application_controller.rb
index d47c060..0e2d820 100644
--- a/webclient/app/controllers/application_controller.rb
+++ b/webclient/app/controllers/application_controller.rb
@@ -4,6 +4,8 @@
class ApplicationController < ActionController::Base
layout 'main'
+ rescue_from Exception, :with => :exception_trap
+
include AuthenticatedSystem
begin
@@ -19,6 +21,13 @@ class ApplicationController < ActionController::Base
super
end
+ def exception_trap(e)
+ logger.error "***" + e.to_s
+ @error = e
+ #render :text => "I am sorry"
+ render :template => "shared/exception_trap"
+ end
+
def ensure_login
unless logged_in?
flash[:notice] = "Please login to continue"
diff --git a/webclient/app/views/shared/exception_trap.html.erb b/webclient/app/views/shared/exception_trap.html.erb
new file mode 100644
index 0000000..a895093
--- /dev/null
+++ b/webclient/app/views/shared/exception_trap.html.erb
@@ -0,0 +1,27 @@
+
+<script type="text/javascript">
+$(document).ready(function() {
+ $('#details-link').click(function() { $('#backtrace').hide();$(this).next().show();return false; });
+});
+</script>
+
+<h1>This is embarrasing....</h1>
+
+<p>We are sorry, but WebYaST is still in alpha and there are some problems.</p>
+
+<h2>Error Message:</h2>
+
+<p><%= @error.to_s %></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.join("\n") %>
+</pre>
+
+
+
+
+
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org