Error Pages¶
If anything goes wrong Bottle displays an informative but fairly boring error page. You can override the default error pages using the error() decorator. It works similar to the route() decorator but expects an HTTP status code instead of a route:
<span class="nd">@error</span><span class="p">(</span><span class="mi">404</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">error404</span><span class="p">(</span><span class="n">error</span><span class="p">):</span>
<span class="k">return</span> <span class="s">'Nothing here, sorry'</span>
The error parameter passed to the error handler is an instance of HTTPError.