Summary
This episode explores function-try-blocks, a rarely used C++ feature that allows wrapping an entire function body in a try-catch block. Jason demonstrates how this syntax works for regular functions but emphasizes its primary practical application in constructors. Function-try-blocks in constructors can catch exceptions thrown during member initialization, providing an opportunity to log or handle initialization failures, though the constructor must still ultimately rethrow an exception as the object cannot be successfully constructed.
Related C++ Standard Sections
This episode covers topics found in these sections of the C++ standard:
-
[runtime.error]76% match -
[except.throw]65% match