better error reporting to help fix bugs

This commit is contained in:
Kyle Drake 2015-02-21 14:08:27 -08:00
parent b782632b69
commit d56edd80ec
2 changed files with 14 additions and 4 deletions

6
app.rb
View file

@ -42,9 +42,7 @@ error do
from: 'web@neocities.org',
to: 'errors@neocities.org',
subject: "[Neocities Error] #{env['sinatra.error'].class}: #{env['sinatra.error'].message}",
body: "#{request.request_method} #{request.path}\n\n" +
(current_site ? "Site: #{current_site.username}\nEmail: #{current_site.email}\n\n" : '') +
env['sinatra.error'].backtrace.join("\n")
body: erb(:'views/templates/email/error')
})
if @api
@ -54,4 +52,4 @@ error do
erb :'error'
end
Dir['./app/**/*.rb'].each {|f| require f}
Dir['./app/**/*.rb'].each {|f| require f}

View file

@ -0,0 +1,12 @@
<%= request.request_method %> <%= request.path %>
<% if current_site %>
Site: <%= current_site.username %>
Email: <%= current_site.email %>
<% end %>
Params:
<%= params.inspect %>
Backtrace:
<%= env['sinatra.error'].backtrace.join("\n") %>