예제 #1
0
 /// <summary>
 /// Marks the specified <see cref="IPromise"/> as success. If the
 /// <see cref="IPromise"/> is done already, logs a message.
 /// </summary>
 /// <param name="promise">The <see cref="IPromise"/> to complete.</param>
 /// <param name="logger">The <see cref="IInternalLogger"/> to use to log a failure message.</param>
 public static void SafeSetSuccess(IPromise promise, IInternalLogger logger)
 {
     if (!promise.IsVoid && !promise.TryComplete() && logger.WarnEnabled)
     {
         var err = promise.Task.Exception?.InnerException;
         if (err is null)
         {
             logger.FailedToMarkAPromiseAsSuccess(promise);
         }
         else
         {
             logger.FailedToMarkAPromiseAsSuccessFailed(promise, err);
         }
     }
 }