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

Class HTTPError

source code

              object --+            
                       |            
exceptions.BaseException --+        
                           |        
        exceptions.Exception --+    
                               |    
               CherryPyException --+
                                   |
                                  HTTPError
Known Subclasses:

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)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
set_response(self)
Modify cherrypy.response status, headers, and body to represent self.
source code
 
get_error_page(self, *args, **kwargs) source code
 
__call__(self)
Use this exception as a request.handler (raise self).
source code

Inherited from exceptions.Exception: __new__

Inherited from exceptions.BaseException: __delattr__, __getattribute__, __getitem__, __getslice__, __reduce__, __repr__, __setattr__, __setstate__, __str__

Inherited from object: __hash__, __reduce_ex__

Properties [hide private]

Inherited from exceptions.BaseException: args, message

Inherited from object: __class__

Method Details [hide private]

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

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

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.