Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 1.01 KB

ExceptionCollector.md

File metadata and controls

32 lines (22 loc) · 1.01 KB

ExceptionCollector

Contents

Usage

ExceptionCollector is a utility that allows you to have multiple exceptions thrown, without stopping the execution of the program, and then throw them all later.

ApprovalTests::ExceptionCollector exceptions;

for (int i = 1; i <= 4; ++i)
{
    exceptions.gather([&]() { /* Code that may throw errors here */ });
}
exceptions.release(); // All errors actually thrown together here

snippet source | anchor

Use with Approval Tests: See Approving multiple files in one test.


Back to User Guide