3 ms·
When you are writing a library, you don't know what the program that calls you might have set up to handle failures, but you know exactly how to get to it: thro
by ncmncm 5y ago
When you are writing a library, you don't know what the program that calls you might have set up to handle failures, but you know exactly how to get to it: throw, and you are there, and it is now for the caller to decide what to do, thus not your problem. A library that exits has stolen control away from its rightful owner.
Very few languages are as finely tuned to the needs of libraries and users of libraries as C++. Exceptions are an essential part of that compact. Failing to abide by it makes your library a bad citizen.
- deleted 5y ago[deleted]
- kinjba11 5y agoIn any case, these arguments have been hashed many times. I always recommend reading Joe Duffy's post on errors for the curious. http://joeduffyblog.com/2016/02/07/the-error-model/ http://joeduffyblog.com/2016/02/07/the-error-model/