Skip to content

Instantly share code, notes, and snippets.

@bdotdub
Created January 7, 2009 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bdotdub/44276 to your computer and use it in GitHub Desktop.
Save bdotdub/44276 to your computer and use it in GitHub Desktop.
--- a/lib/sinatra.rb
+++ b/lib/sinatra.rb
@@ -1260,7 +1260,8 @@ module Sinatra
request.env['rack.errors'] << msg
request.env['sinatra.error'] = e
- context.status(500)
+ status = e.class.respond_to?(:code) ? e.class.code : 500
+ context.status(status)
raise if options.raise_errors && e.class != NotFound
result = (errors[e.class] || errors[ServerError]).invoke(request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment