Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1334

Show
Ignore:
Timestamp:
09/04/06 16:12:38
Author:
jtate
Message:

Make a CherryPyException?, from which all exceptions inherit, and also is available from "import cherrypy".

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/__init__.py

    r1332 r1334  
    66_localdir = _os.path.dirname(__file__) 
    77 
    8 from cherrypy._cperror import HTTPError, HTTPRedirect, InternalRedirect, NotFound 
     8from cherrypy._cperror import HTTPError, HTTPRedirect, InternalRedirect, NotFound, CherryPyException 
    99from cherrypy._cperror import TimeoutError 
    1010 
  • trunk/cherrypy/_cperror.py

    r1308 r1334  
    77 
    88import exceptions 
    9 class Exception(exceptions.Exception): 
     9class CherryPyException(exceptions.Exception): 
    1010    pass 
    1111 
    12 class InternalRedirect(Exception): 
     12class InternalRedirect(CherryPyException): 
    1313    """Exception raised when processing should be handled by a different path. 
    1414     
     
    3838        self.path = path 
    3939         
    40         Exception.__init__(self, path) 
    41  
    42  
    43  
    44 class HTTPRedirect(Exception): 
     40        CherryPyException.__init__(self, path) 
     41 
     42 
     43 
     44class HTTPRedirect(CherryPyException): 
    4545    """Exception raised when the request should be redirected. 
    4646     
     
    8282         
    8383        self.status = status 
    84         Exception.__init__(self, abs_urls, status) 
     84        CherryPyException.__init__(self, abs_urls, status) 
    8585     
    8686    def set_response(self): 
     
    139139 
    140140 
    141 class HTTPError(Exception): 
     141class HTTPError(CherryPyException): 
    142142    """ Exception used to return an HTTP error code (4xx-5xx) to the client. 
    143143        This exception will automatically set the response status and body. 
     
    152152            raise ValueError("status must be between 400 and 599.") 
    153153        self.message = message 
    154         Exception.__init__(self, status, message) 
     154        CherryPyException.__init__(self, status, message) 
    155155     
    156156    def set_response(self): 
     
    212212 
    213213 
    214 class TimeoutError(Exception): 
     214class TimeoutError(CherryPyException): 
    215215    """Exception raised when Response.timed_out is detected.""" 
    216216    pass 

Hosted by WebFaction

Log in as guest/cpguest to create tickets