(ray_exception)
| 45 | |
| 46 | @staticmethod |
| 47 | def from_ray_exception(ray_exception): |
| 48 | if ray_exception.language == PYTHON: |
| 49 | try: |
| 50 | return pickle.loads(ray_exception.serialized_exception) |
| 51 | except Exception: |
| 52 | # formatted_exception_string is set in to_bytes() above by calling |
| 53 | # traceback.format_exception() on the original exception. It contains |
| 54 | # the string representation and stack trace of the original error. |
| 55 | original_stacktrace = getattr( |
| 56 | ray_exception, |
| 57 | "formatted_exception_string", |
| 58 | "No formatted exception string available.", |
| 59 | ) |
| 60 | return UnserializableException(original_stacktrace) |
| 61 | else: |
| 62 | return CrossLanguageError(ray_exception) |
| 63 | |
| 64 | |
| 65 | @PublicAPI |
no test coverage detected