Preserve the original exception type when converting to RayTaskError (#5799)

This commit is contained in:
Eric Liang
2019-09-28 17:03:15 -07:00
committed by GitHub
parent 493364d3bd
commit 81ee887f91
5 changed files with 57 additions and 10 deletions
+7 -1
View File
@@ -63,14 +63,20 @@ def test_failed_task(ray_start_regular):
# ray.get should throw an exception.
assert False
class CustomException(ValueError):
pass
@ray.remote
def f():
raise Exception("This function failed.")
raise CustomException("This function failed.")
try:
ray.get(f.remote())
except Exception as e:
assert "This function failed." in str(e)
assert isinstance(e, CustomException)
assert isinstance(e, ray.exceptions.RayTaskError)
assert "RayTaskError(CustomException)" in repr(e)
else:
# ray.get should throw an exception.
assert False