diff Implab/IResolvable.cs @ 244:eee3e49dd1ff v3

working on promises
author cin
date Thu, 25 Jan 2018 19:09:16 +0300
parents
children b904e0a3ba72
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Implab/IResolvable.cs	Thu Jan 25 19:09:16 2018 +0300
@@ -0,0 +1,26 @@
+using System;
+
+namespace Implab {
+    /// <summary>
+    /// Deferred result, usually used by asynchronous services as the service part of the promise.
+    /// </summary>
+    public interface IResolvable {
+
+        void Resolve();
+
+        void Resolve(IPromise thenable);
+
+        /// <summary>
+        /// Reject the promise with the specified error.
+        /// </summary>
+        /// <param name="error">The reason why the promise is rejected.</param>
+        /// <remarks>
+        /// Some exceptions are treated in a special case: 
+        /// <see cref="OperationCanceledException"/> is interpreted as call to <see cref="Cancel()"/> method,
+        /// and <see cref="PromiseTransientException"/> is always unwrapped and its
+        /// <see cref="PromiseTransientException.InnerException"> is used as the reason to reject promise.
+        /// </remarks>
+        void Reject(Exception error);
+    }
+}
+