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