> Read the latest version of this page
Edit me on GitHub

pyramid.exceptions

class Forbidden(message='')[source]

Raise this exception within view code to immediately return the forbidden view to the invoking user. Usually this is a basic 403 page, but the forbidden view can be customized as necessary. See Changing the Forbidden View.

This exception’s constructor accepts a single positional argument, which should be a string. The value of this string will be placed onto the request by the router as the exception_message attribute, for availability to the Forbidden View.

class NotFound(message='')[source]

Raise this exception within view code to immediately return the Not Found view to the invoking user. Usually this is a basic 404 page, but the Not Found view can be customized as necessary. See Changing the Not Found View.

This exception’s constructor accepts a single positional argument, which should be a string. The value of this string will be placed into the WSGI environment by the router as the exception_message attribute, for availability to the Not Found View.

class ConfigurationError[source]

Raised when inappropriate input values are supplied to an API method of a Configurator

class URLDecodeError[source]

This exception is raised when Pyramid cannot successfully decode a URL or a URL path segment. This exception it behaves just like the Python builtin UnicodeDecodeError. It is a subclass of the builtin UnicodeDecodeError exception only for identity purposes, mostly so an exception view can be registered when a URL cannot be decoded.

Previous topic

pyramid.events

Next topic

pyramid.httpexceptions

This Page