diff --git a/python/cudf/cudf/core/indexed_frame.py b/python/cudf/cudf/core/indexed_frame.py index 01334634540..c20cbf52179 100644 --- a/python/cudf/cudf/core/indexed_frame.py +++ b/python/cudf/cudf/core/indexed_frame.py @@ -769,7 +769,7 @@ def _apply(self, func, kernel_getter, *args, **kwargs): ) except Exception as e: raise ValueError( - "user defined function compilation or execution failed." + "user defined function compilation failed." ) from e # Mask and data column preallocated @@ -790,7 +790,11 @@ def _apply(self, func, kernel_getter, *args, **kwargs): offsets.append(col.offset) launch_args += offsets launch_args += list(args) - kernel.forall(len(self))(*launch_args) + + try: + kernel.forall(len(self))(*launch_args) + except Exception as e: + raise RuntimeError("UDF kernel execution failed.") from e col = as_column(ans_col) col.set_base_mask(libcudf.transform.bools_to_mask(ans_mask))