Commits

Robert Brewer committed bb06c24

Fix for #307. Made InternalError a subclass of HTTPError(500). Removed all use of InternalError from the framework; it should be removed in 2.2.

  • Participants
  • Parent commits 2ffa69a

Comments (0)

Files changed (2)

File cherrypy/_cperror.py

 class Error(Exception):
     pass
 
-class InternalError(Error):
-    """ Error that should never happen """
-    pass
-
 class NotReady(Error):
     """A request was made before the app server has been started."""
     pass
     def __init__(self, path):
         self.args = (path,)
         HTTPError.__init__(self, 404, "The path %s was not found." % repr(path))
+
+
+class InternalError(HTTPError):
+    """ Error that should never happen """
+    
+    def __init__(self, message=None):
+        HTTPError.__init__(self, 500, message)

File cherrypy/_cputil.py

     
     try:
         return globals()[name]
-    except KeyError:
-        raise cherrypy.InternalError("Special attribute %s could not be found"
-                                     % repr(name))
+    except KeyError:
+        msg = "Special attribute %s could not be found" % repr(name)
+        raise cherrypy.HTTPError(500, msg)
 
 def getSpecialAttributePath(name):
     """ Return the path to the special attribute """
         for i in xrange(len(objectList) - 1, -1, -1):
             if hasattr(objectList[i], name):
                 return "/" + "/".join(pathList[:i] + [name])
-    raise cherrypy.InternalError("Special attribute %s could not be found"
-                                 % repr(name))
+    msg = "Special attribute %s could not be found" % repr(name)
+    raise cherrypy.HTTPError(500, msg)
 
 
 def logtime():