Quantum 3 3.1.0

Static Public Member Functions | List of all members
Quantum.ExceptionUtils Class Reference

Utility methods to work with exceptions. More...

Static Public Member Functions

static void Aggregate (ref List< Exception > exceptions, Exception exn)
 Adds an exception to the collected exceptions, to be thrown later with ThrowIfAny. The list is only created when the first exception is added, so loops where nothing fails don't allocate. More...
 
static void ThrowIfAny (List< Exception > exceptions)
 Throws the collected exceptions, used by loops that run every element before reporting what failed. A single exception is rethrown as is with its original stack trace, several are thrown as an AggregateException. Does nothing if exceptions is null or empty. More...
 

Detailed Description

Utility methods to work with exceptions.

Member Function Documentation

◆ ThrowIfAny()

static void Quantum.ExceptionUtils.ThrowIfAny ( List< Exception >  exceptions)
inlinestatic

Throws the collected exceptions, used by loops that run every element before reporting what failed. A single exception is rethrown as is with its original stack trace, several are thrown as an AggregateException. Does nothing if exceptions is null or empty.

Parameters
exceptionsThe collected exceptions

◆ Aggregate()

static void Quantum.ExceptionUtils.Aggregate ( ref List< Exception >  exceptions,
Exception  exn 
)
inlinestatic

Adds an exception to the collected exceptions, to be thrown later with ThrowIfAny. The list is only created when the first exception is added, so loops where nothing fails don't allocate.

Parameters
exceptionsThe collected exceptions, created if null
exnThe exception to add