Ticket #4: foolscap-copiedremoteexception.patch

File foolscap-copiedremoteexception.patch, 1.2 kB (added by strank, 3 years ago)
  • a/foolscap/call.py

    old new  
    766766        state['parents'] = obj.parents 
    767767        return state 
    768768 
     769 
     770class CopiedRemoteException(Exception): 
     771    """I represent an exception thrown on the remote end 
     772    (real Exception, old-style instance, or string), 
     773    I am a base class for locally reconstructed Exceptions. 
     774    You can catch me in a try block if you want. 
     775    """  
     776 
    769777class CopiedFailure(failure.Failure, copyable.RemoteCopyOldStyle): 
    770778    # this is a RemoteCopyOldStyle because you can't raise new-style 
    771779    # instances as exceptions. 
     
    821829 
    822830        assert isinstance(self.type, str) 
    823831        typepieces = self.type.split(".") 
    824         class ExceptionLikeString
     832        class ExceptionLikeString(CopiedRemoteException)
    825833            pass 
    826834        self.type = ExceptionLikeString 
    827835        self.type.__module__ = ".".join(typepieces[:-1])