Last Updated: May 22, 2026
The C++ standard library ships with a small family of exception classes rooted at std::exception. Throwing one of these instead of a raw int or a hand-rolled string gives every catch site a single, predictable interface: a what() method that returns a description. The hierarchy also splits problems into two useful categories: bugs that could have been caught earlier, and failures that depend on the world outside the code.