Mercurial > pub > ImplabNet
comparison Implab/ExceptionHelpers.cs @ 248:5cb4826c2c2a v3
Added awaiters to promises
Added static methods to Promise Resolve, Reject, All.
Updated promise helpers
author | cin |
---|---|
date | Tue, 30 Jan 2018 01:37:17 +0300 |
parents | |
children | d82909310094 |
comparison
equal
deleted
inserted
replaced
247:fb70574741a1 | 248:5cb4826c2c2a |
---|---|
1 using System; | |
2 using System.Reflection; | |
3 using System.Runtime.ExceptionServices; | |
4 | |
5 namespace Implab { | |
6 public static class ExceptionHelpers { | |
7 public static void Rethrow(this Exception that) { | |
8 ExceptionDispatchInfo.Capture(that).Throw(); | |
9 } | |
10 | |
11 public static void ThrowInvocationException(this Exception that) { | |
12 if (that is OperationCanceledException) | |
13 throw new OperationCanceledException("Operation cancelled", that); | |
14 else | |
15 throw new TargetInvocationException(that); | |
16 } | |
17 } | |
18 } |