< Summary

Information
Class: Gravitas.CollisionHandling.CollisionNotificationExceptions
Assembly: Gravitas
File(s): /home/runner/work/Gravitas/Gravitas/src/Gravitas/CollisionHandling/Pairs/CollisionNotificationExceptions.cs
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 32
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Capture(...)100%22100%
ThrowIfAny(...)100%44100%

File(s)

/home/runner/work/Gravitas/Gravitas/src/Gravitas/CollisionHandling/Pairs/CollisionNotificationExceptions.cs

#LineLine coverage
 1//=======================================================================
 2// CollisionNotificationExceptions.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2026–present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using SwiftCollections;
 9using System;
 10using System.Runtime.CompilerServices;
 11using System.Runtime.ExceptionServices;
 12
 13namespace Gravitas.CollisionHandling;
 14
 15internal static class CollisionNotificationExceptions
 16{
 17    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 18    internal static void Capture(ref SwiftList<Exception>? exceptions, Exception exception) =>
 2019        (exceptions ??= new SwiftList<Exception>(2)).Add(exception);
 20
 21    [MethodImpl(MethodImplOptions.NoInlining)]
 22    internal static void ThrowIfAny(SwiftList<Exception>? exceptions)
 23    {
 578424        if (exceptions == null)
 576725            return;
 26
 1727        if (exceptions.Count == 1)
 1428            ExceptionDispatchInfo.Capture(exceptions[0]).Throw();
 29
 330        throw new AggregateException(exceptions);
 31    }
 32}