(kind, result)
| 96 | del result # break reference cycle |
| 97 | |
| 98 | def convert_to_error(kind, result): |
| 99 | if kind == '#ERROR': |
| 100 | return result |
| 101 | elif kind in ('#TRACEBACK', '#UNSERIALIZABLE'): |
| 102 | if not isinstance(result, str): |
| 103 | raise TypeError( |
| 104 | "Result {0!r} (kind '{1}') type is {2}, not str".format( |
| 105 | result, kind, type(result))) |
| 106 | if kind == '#UNSERIALIZABLE': |
| 107 | return RemoteError('Unserializable message: %s\n' % result) |
| 108 | else: |
| 109 | return RemoteError(result) |
| 110 | else: |
| 111 | return ValueError('Unrecognized message type {!r}'.format(kind)) |
| 112 | |
| 113 | class RemoteError(Exception): |
| 114 | def __str__(self): |
no test coverage detected