diff options
Diffstat (limited to 'dsa/FireBase/Extensions/TaskExtensions.cs')
-rw-r--r-- | dsa/FireBase/Extensions/TaskExtensions.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/dsa/FireBase/Extensions/TaskExtensions.cs b/dsa/FireBase/Extensions/TaskExtensions.cs new file mode 100644 index 0000000..c955b3a --- /dev/null +++ b/dsa/FireBase/Extensions/TaskExtensions.cs @@ -0,0 +1,23 @@ +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; + } + } + } +}
\ No newline at end of file |