# HG changeset patch
# User strank(AT)strank(DOT)info
# Date 1208359077 -7200
# Node ID a5ee14862f1215ebbaaa457c942319f2c71908f2
# Parent ecf45dffc5cb2ebe3d1f64bf61b13aec73fcea90
add CopiedRemoteException, new-style class to allow catching in except
diff -r ecf45dffc5cb -r a5ee14862f12 foolscap/call.py
a
|
b
|
|
820 | 820 | |
821 | 821 | return state |
822 | 822 | |
| 823 | class CopiedRemoteException(Exception): |
| 824 | """I represent an exception thrown on the remote end |
| 825 | (real Exception, old-style instance, or string), |
| 826 | I am a base class for locally reconstructed Exceptions. |
| 827 | You can catch me in a try block if you want. |
| 828 | """ |
| 829 | |
823 | 830 | class CopiedFailure(failure.Failure, copyable.RemoteCopyOldStyle): |
824 | 831 | # this is a RemoteCopyOldStyle because you can't raise new-style |
825 | 832 | # instances as exceptions. |
… |
… |
|
887 | 894 | |
888 | 895 | assert isinstance(self.type, str) |
889 | 896 | typepieces = self.type.split(".") |
890 | | class ExceptionLikeString: |
| 897 | class ExceptionLikeString(CopiedRemoteException): |
891 | 898 | pass |
892 | 899 | self.type = ExceptionLikeString |
893 | 900 | self.type.__module__ = ".".join(typepieces[:-1]) |