[FEA] Throw more specific exceptions in libcudf
- Dominant language
- C++
- Stars
- 9.8k
- Forks
- 1.1k
- Avg merge
- 3d 6m
- Merged PRs (30d)
- 278
Description
**Is your feature request related to a problem? Please describe.**
The discussion in #10200 demonstrated a general desire to have libcudf provide more useful diagnostics of failure modes to users by throwing more informative exceptions for different types of failures instead of always throwing `cudf::logic_error`. #12426 implemented the necessary scaffolding in cuDF Python and the libcudf JNI to allow libcudf to use any C++ exception -- including custom exceptions defined within libcudf -- and have these mapped to appropriate Java or Python exceptions. #12426 also demonstrated how such a custom exception could be defined, introducing `cudf::data_type_error`. The purpose of this issue is to serve as tracking for the task of systematically converting libcudf to throw better exceptions.
**Describe the solution you'd like**
I propose that we tackle this task on a file-by-file basis. This issue can serve as a tracker for which files have been updated as well as the definitive source of what exceptions libcudf throws under what circumstances. For each file, a developer would go through each CUDF_EXPECTS/CUDF_FAIL call and see if there is a suitable alternative to `cudf::logic_error`. If none currently exists, developers should propose a new exception and explain situations in which it should be used in a new issue. If the proposal is accepted, the table of exceptions below should be updated.
Table of exceptions:
| Exception | Description | Issue | Status |
| ------------- |:-------------:|:-------------:|:-------------:|
| std::invalid_argument | A function parameter is provided a value that is invalid in the given context. | https://github.com/rapidsai/cudf/issues/10632 | ✅ by https://github.com/rapidsai/cudf/pull/12426 |
| cudf::data_type_error | A function is called with a column or scalar with a `data_type` for which the function is invalid. A common example is in the default SFINAE overloads of type-dispatched functions. | https://github.com/rapidsai/cudf/issues/10632 | ✅ by https://github.com/rapidsai/cudf/pull/12426 |
| std::overflow_error | The output column corresponding to the input has size exceeds cudf limit. | https://github.com/rapidsai/cudf/issues/12925 | #13323 |
| std::out_of_range | An index argument or range includes indices that are out of bounds for the column being selected | #15315 | Some work in #15319 |
List of files to be updated (please add new lines to the task list when a file is updated):
Contributor guide
Assessment
This issue has not been assessed yet.