summaryrefslogtreecommitdiff
path: root/FireBase/Extensions/TaskExtensions.cs
diff options
context:
space:
mode:
authorTrueDoctor <d-kobert@web.de>2018-09-29 16:51:26 +0200
committerTrueDoctor <d-kobert@web.de>2018-09-29 16:51:26 +0200
commitde0f076ef9ff546c9a90513259ad6c42cd2224b3 (patch)
tree995d766417fd2093d7950694ef17f3c84b7f1042 /FireBase/Extensions/TaskExtensions.cs
parent04912687127303fd270b61f131cf68fd4aaae956 (diff)
added firebase api
Diffstat (limited to 'FireBase/Extensions/TaskExtensions.cs')
-rw-r--r--FireBase/Extensions/TaskExtensions.cs23
1 files changed, 23 insertions, 0 deletions
diff --git a/FireBase/Extensions/TaskExtensions.cs b/FireBase/Extensions/TaskExtensions.cs
new file mode 100644
index 0000000..26bbde6
--- /dev/null
+++ b/FireBase/Extensions/TaskExtensions.cs
@@ -0,0 +1,23 @@
+namespace Firebase.Database.Extensions
+{
+ using System;
+ using System.Threading.Tasks;
+
+ 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;
+ }
+ }
+ }
+}