- Why throw exceptions? (as opposed to using error codes)
- When to throw an exception.
- When not to throw an exception.
Any condition that prevents a method/function from completing its designed objective should result in an exception being thrown. These conditions can arise from invalid input data (a precondition error) or a failure to generate valid output data (return values, class invariants, etc).
For a more complete explanation read:
When and How to Use Exceptions
C/C++ Users Journal August, 2004
No comments:
Post a Comment