From 59e797e99775c5abc7493bf24b9027de3ccad96d Mon Sep 17 00:00:00 2001 From: Simon Rozet Date: Wed, 23 Dec 2009 03:10:14 +0100 Subject: [PATCH] Doc for error(500) { } --- README.rdoc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.rdoc b/README.rdoc index ee59863c..9569c0e7 100644 --- a/README.rdoc +++ b/README.rdoc @@ -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 not_found and error handlers when running under the development environment.