Last Updated: May 17, 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 to work with: a what() method that returns a description. The hierarchy also splits problems into two useful categories, bugs you could have caught earlier and failures that depend on the world outside your code.