Doc for error(500) { }

This commit is contained in:
Simon Rozet 2009-12-23 03:10:14 +01:00
parent 63fd77348d
commit 59e797e997
1 changed files with 16 additions and 0 deletions

View File

@ -406,6 +406,22 @@ You get this:
So what happened was... something bad
Alternatively, you can install error handler for a status code:
error 403 do
'Access forbidden'
end
get '/secret' do
403
end
Or a range:
error 400..510 do
'Boom'
end
Sinatra installs special <tt>not_found</tt> and <tt>error</tt> handlers when
running under the development environment.