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)
| 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__ |