RAII failure count convenience class for use with AAX_CAPTURE() or AAX_CAPTURE_MULT()
Pass this object as the first argument in a series of AAX_CAPTURE() calls to count the number of failures that occur and to re-throw the last error if zero of the attempted calls succeed.
#define AAX_CAPTURE(X,...)
Executes Y in a try/catch block that catches AAX::Exception::ResultError exceptions and captures the ...
Definition: AAX_Exception.h:499
Definition: AAX_Exception.h:589
In this example, when agg goes out of scope it checks whether any of A, B, or C succeeded. If none succeeded then the last error that was encountered is raised via an AAX_CheckedResult::Exception. If at least one of the calls succeeded then any failures are swallowed and execution continues as normal. This approach can be useful in cases where you want to run every operation in a group and you only want a failure to be returned if all of the operations failed.
Definition: AAX_Exception.h:314
In this example, the last error encountered by agg is converted to an AAX_CheckedResult. This will result in an AAX_CheckedResult::Exception even if at least one of the attempted operations succeeded. This approach can be useful in cases where you want all operations in a group to be executed before an error is raised for any failure within the group.