Ticket #836 (defect)
Opened 2 months ago
Last modified 2 months ago
Can't raise exceptions over XMLRPC
Status: closed (fixed)
| Reported by: | guest | Assigned to: | fumanchu |
|---|---|---|---|
| Priority: | high | Milestone: | 3.1 |
| Component: | CherryPy code | Keywords: | on_error error handling |
| Cc: |
Hey guys... there seems to be a bug when trying to raise an exception across XMLRPC (this has worked for me before, not sure when it crept up). Since it dies on the server side because TypeError: on_error() takes no arguments (1 given) this results in a ProtocolError: <ProtocolError for host:8080/api/: 500 Internal Server Error> on the client side. It's probably a pretty trivial fix for you who know what's going on; I've looked through the code but couldn't figure it out.
[05/Jul/2008:15:36:25] HTTP Traceback (most recent call last): File "/var/lib/python-support/python2.5/cherrypy/_cprequest.py", line 551, in respond cherrypy.response.body = self.handler() File "/var/lib/python-support/python2.5/cherrypy/_cpdispatch.py", line 24, in __call__ return self.callable(*self.args, **self.kwargs) File "/var/lib/python-support/python2.5/cherrypy/_cptools.py", line 258, in __call__ body = subhandler(*(vpath + rpcparams), **params) File "test.py", line 62, in function raise Exception("test") Exception: test [05/Jul/2008:15:36:25] Traceback (most recent call last): File "/var/lib/python-support/python2.5/cherrypy/_cprequest.py", line 485, in run self.respond(pi) File "/var/lib/python-support/python2.5/cherrypy/_cprequest.py", line 565, in respond self.handle_error(sys.exc_info()) File "/var/lib/python-support/python2.5/cherrypy/_cprequest.py", line 670, in handle_error self.error_response() File "/var/lib/python-support/python2.5/cherrypy/_cptools.py", line 172, in _wrapper self.callable(**self._merged_args()) TypeError: on_error() takes no arguments (1 given) - - [05/Jul/2008:15:36:25] "POST /api/ HTTP/1.0" 500 - "" "" [05/Jul/2008:15:36:25] HTTP Traceback (most recent call last): File "/var/lib/python-support/python2.5/cherrypy/_cprequest.py", line 551, in respond cherrypy.response.body = self.handler() File "/var/lib/python-support/python2.5/cherrypy/_cpdispatch.py", line 24, in __call__ return self.callable(*self.args, **self.kwargs) File "test.py", line 73, in index print x.function() File "/usr/lib/python2.5/xmlrpclib.py", line 1147, in __call__ return self.__send(self.__name, args) File "/usr/lib/python2.5/xmlrpclib.py", line 1437, in __request verbose=self.__verbose File "./web/resource/xmlrpcclient.py", line 95, in request headers ProtocolError: <ProtocolError for host:8080/api/: 500 Internal Server Error>
Change History
07/05/08 21:37:44: Modified by guest
07/05/08 21:52:07: Modified by fumanchu
- status changed from new to closed.
- resolution set to fixed.
Fixed in [2015]. Looks like it only worked when the user supplied no other tools.xmlrpc.* settings.


Patch:
In lib.xmlrpc, change def on_error(): to...