Metaclass that wraps exception type in RemoteException
(exc: Exception, tb)
| 77 | |
| 78 | |
| 79 | def remote_exception(exc: Exception, tb) -> Exception: |
| 80 | """Metaclass that wraps exception type in RemoteException""" |
| 81 | if type(exc) in exceptions: |
| 82 | typ = exceptions[type(exc)] |
| 83 | return typ(exc, tb) |
| 84 | else: |
| 85 | try: |
| 86 | typ = type( |
| 87 | exc.__class__.__name__, |
| 88 | (RemoteException, type(exc)), |
| 89 | {"exception_type": type(exc)}, |
| 90 | ) |
| 91 | exceptions[type(exc)] = typ |
| 92 | return typ(exc, tb) |
| 93 | except TypeError: |
| 94 | return exc |
| 95 | |
| 96 | |
| 97 | try: |
no outgoing calls