error reporting

This commit is contained in:
Kyle Drake 2013-07-13 11:01:13 -04:00
parent f059772d5e
commit 38b2914e70
2 changed files with 17 additions and 0 deletions

12
app.rb
View file

@ -16,6 +16,17 @@ not_found do
slim :'not_found'
end
error do
EmailWorker.perform_async({
from: 'web@neocities.org',
to: 'errors@neocities.org',
subject: "[NeoCities Error] #{env['sinatra.error'].name}",
body: "#{env['sinatra.error'].message}\n\n#{env['sinatra.error'].backtrace}"
})
slim :'error'
end
get '/?' do
dashboard_if_signed_in
slim :index
@ -423,6 +434,7 @@ get '/password_reset_confirm' do
end
get '/contact' do
raise 'hell'
slim :'contact'
end

5
views/error.slim Normal file
View file

@ -0,0 +1,5 @@
.row
.span8.offset2.text-center
h2 Site Error
h4 There has been an error performing the requested action. We have been notified of the problem.
h5 If you need to add any special information or if this error has not been resolved in a while, <a href="/contact">contact us</a> and report the problem. Thank you!