~ruther/NosSmooth

938621d74db3d78079297abf476c55cf6c0b82be — Rutherther 2 years ago edc0779
fix(game): make aggregate error only for errors, not successful results in event dispatcher
1 files changed, 8 insertions(+), 3 deletions(-)

M Core/NosSmooth.Game/Events/Core/EventDispatcher.cs
M Core/NosSmooth.Game/Events/Core/EventDispatcher.cs => Core/NosSmooth.Game/Events/Core/EventDispatcher.cs +8 -3
@@ 62,11 62,16 @@ public class EventDispatcher
                )
        );

        return results.Length switch
        var errors = results
            .Where(x => !x.IsSuccess)
            .Cast<IResult>()
            .ToArray();

        return errors.Length switch
        {
            0 => Result.FromSuccess(),
            1 => results[0],
            _ => new AggregateError(results.Cast<IResult>().ToArray()),
            1 => (Result)errors[0],
            _ => new AggregateError(errors),
        };
    }
}
\ No newline at end of file

Do not follow this link