MCPcopy Index your code
hub / github.com/ray-project/ray / make_dual_exception_instance

Method make_dual_exception_instance

python/ray/exceptions.py:161–173  ·  view source on GitHub ↗

Makes a object instance that inherits from both RayTaskError and the type of `self.cause`. Raises TypeError if the cause class can't be subclassed

(self)

Source from the content-addressed store, hash-verified

159 assert traceback_str is not None
160
161 def make_dual_exception_instance(self) -> "RayTaskError":
162 """Makes a object instance that inherits from both RayTaskError and the type of
163 `self.cause`. Raises TypeError if the cause class can't be subclassed"""
164 # For normal user Exceptions, we subclass from both
165 # RayTaskError and the user exception. For ExceptionGroup,
166 # we special handle it because it has a different __new__()
167 # signature from Exception.
168 # Ref: https://docs.python.org/3/library/exceptions.html#exception-groups
169 if sys.version_info >= (3, 11) and isinstance(
170 self.cause, ExceptionGroup # noqa: F821
171 ):
172 return self._make_exceptiongroup_dual_exception_instance()
173 return self._make_normal_dual_exception_instance()
174
175 def _make_normal_dual_exception_instance(self) -> "RayTaskError":
176 cause_cls = self.cause.__class__

Callers 2

as_instanceof_causeMethod · 0.95

Tested by 1