isocpp / isocpp/CppCoreGuidelines
Error Handling with Core Guidelines GSL Expects, Ensures, and narrow_cast
@hsutter is already working on this.
Since Oct 1, 2020.
- Dominant language
- CSS
- Stars
- 45.3k
- Forks
- 5.6k
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to follow the Cpp Core Guidelines and use GSL where appropriate. In particular, I would like to use Expects and Ensures for pre and post-conditions, as well as span, and narrow_cast, but the error handling is not robust and does not provide any diagnostics. When encountering errors GSL simply calls terminate leaving the tester with no clues as to what caused the termination.
So my question is: How does one use GSL and keep code robust in the presence of errors? Or more simply, how to use GSL and get error diagnostics prior to termination?
(I posted this same question on StackOverflow, https://stackoverflow.com/questions/63350483/error-handling-with-core-guidelines-gsl-expects-ensures-and-narrow-cast, but it has not received any feedback.)
I appreciate any help.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.