Package cherrypy :: Module _cperror :: Class HTTPError
[hide private]
[frames] | no frames]

Class HTTPError

source code

exceptions.Exception --+    
                       |    
       CherryPyException --+
                           |
                          HTTPError
Known Subclasses:
NotFound

Exception used to return an HTTP error code (4xx-5xx) to the client. This exception will automatically set the response status and body.

A custom message (a long description to display in the browser) can be provided in place of the default.

Instance Methods [hide private]
 
__init__(self, status=500, message=None) source code
 
set_response(self)
Modify cherrypy.response status, headers, and body to represent self.
source code
 
__call__(self)
Use this exception as a request.handler (raise self).
source code

Inherited from exceptions.Exception: __getitem__, __str__

Method Details [hide private]

__init__(self, status=500, message=None)
(Constructor)

source code 
Overrides: exceptions.Exception.__init__

set_response(self)

source code 

Modify cherrypy.response status, headers, and body to represent self.

CherryPy uses this internally, but you can also use it to create an HTTPError object and set its output without *raising* the exception.