Chapter 11

Error Handling

Images

Cippi handles errors.

First of all, according to the C++ Core Guidelines, the following actions are involved in error handling:

  • Detect an error.

  • Transmit information about an error to some handler code.

  • Preserve the valid state of a program.

  • Avoid resource leaks.

You should use exceptions for error handling. David Abrahams, one of the founders of the Boost C++ Library and former member of the ISO C++ standardization committee, formalized in the document “Exception Safety in Generic Components” what exception safety means. “Abrahams guarantees” describe a contract that is fundamental if you think about exception ...

Get C++ Core Guidelines Explained: Best Practices for Modern C++ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.