Permalink
Browse files

error page in production

  • Loading branch information...
1 parent 8113976 commit 73a504226905dc17d6934a5f213c5c55d31a570a @mislav committed May 16, 2012
Showing with 28 additions and 0 deletions.
  1. +10 −0 app.rb
  2. +18 −0 views/error.erb
View
10 app.rb
@@ -101,6 +101,16 @@ def page_title title = nil
erb :not_found
end
+error do
+ err = env['sinatra.error']
+ locals = {}
+ if err.respond_to? :message
+ locals[:error_type] = err.class.name
+ locals[:error_message] = err.message
+ end
+ erb :error, {}, locals
+end
+
get "/" do
cache_control :public
last_modified File.mtime('views/index.erb')
View
@@ -0,0 +1,18 @@
+<div id=error class=container>
+
+ <div class="hero-unit page-header">
+ <h1>BOOM! Something exploded.</h1>
+ <% if defined? error_type %>
+ <p>
+ The error message was:<br>
+ <strong><%== error_type %>:</strong>
+ <%== error_message %>
+ </p>
+ <% end %>
+ <p>
+ Please <a href="https://github.com/mislav/rfc/issues">report bugs here</a>.
+ </p>
+ <nav><a href="<%= home_path %>">&larr; Home</a></nav>
+ </div>
+
+</div>

0 comments on commit 73a5042

Please sign in to comment.