Main Documentation

Displaying Errors

By default, errors will be displayed using the plain error templates provided by WebOb. To customize the display of errors, an error resource needs to be created. The simplest error resource looks like this:

from tangled.web import Resource, config

class Error(Resource):

    @config('text/html', template='/error.html')
    def GET(self):
        return {}

error.html would contain contents like this:

<%inherit file="/layout.html"/>


<div class="error">
  The request failed with status code ${request.status_code}

To activate the error resource, point the setting at it:

[app] = my.pkg.resources.error:Error