Skip to content
This repository has been archived by the owner on Oct 20, 2020. It is now read-only.

Commit

Permalink
error page in production
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed May 16, 2012
1 parent 8113976 commit 73a5042
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ def page_title title = nil
erb :not_found erb :not_found
end 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 get "/" do
cache_control :public cache_control :public
last_modified File.mtime('views/index.erb') last_modified File.mtime('views/index.erb')
Expand Down
18 changes: 18 additions & 0 deletions views/error.erb
Original file line number Original file line Diff line number Diff line change
@@ -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.