summaryrefslogtreecommitdiff
path: root/dsa/FireBase/Extensions/TaskExtensions.cs
blob: 68d45385a75b788d0c50a6bb79daa658e2649135 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
using System;
using System.Threading.Tasks;

namespace Firebase.Database.Extensions {
    public static class TaskExtensions {
        /// <summary>
        ///     Instead of unwrapping <see cref="AggregateException" /> it throws it as it is.
        /// </summary>
        public static async Task WithAggregateException(this Task source) {
            try {
                await source.ConfigureAwait(false);
            }
            catch (Exception ex) {
                throw source.Exception ?? ex;
            }
        }
    }
}