Commit b63c5045 by rfkelly0

fix raising of non-FSError errors in RPCFS

parent 48231637
...@@ -8,6 +8,7 @@ class from the :mod:`fs.expose.xmlrpc` module. ...@@ -8,6 +8,7 @@ class from the :mod:`fs.expose.xmlrpc` module.
""" """
import sys
import xmlrpclib import xmlrpclib
import socket import socket
...@@ -24,8 +25,6 @@ def re_raise_faults(func): ...@@ -24,8 +25,6 @@ def re_raise_faults(func):
try: try:
return func(*args,**kwds) return func(*args,**kwds)
except xmlrpclib.Fault, f: except xmlrpclib.Fault, f:
#import traceback
#traceback.print_exc()
# Make sure it's in a form we can handle # Make sure it's in a form we can handle
bits = f.faultString.split(" ") bits = f.faultString.split(" ")
if bits[0] not in ["<type","<class"]: if bits[0] not in ["<type","<class"]:
...@@ -38,7 +37,10 @@ def re_raise_faults(func): ...@@ -38,7 +37,10 @@ def re_raise_faults(func):
cls = _object_by_name(cls) cls = _object_by_name(cls)
# Re-raise using the remainder of the fault code as message # Re-raise using the remainder of the fault code as message
if cls: if cls:
raise cls('', msg=msg) if issubclass(cls,FSError):
raise cls('', msg=msg)
else:
raise cls(msg)
raise f raise f
except socket.error, e: except socket.error, e:
raise RemoteConnectionError(str(e), details=e) raise RemoteConnectionError(str(e), details=e)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment