/// <summary>
 /// Completes the promise.
 /// onResolved is called on successful completion.
 /// Adds a default error handler.
 /// </summary>
 public void Done(Action <PromisedT> onResolved)
 {
     Then(onResolved)
     .Catch(ex =>
            Promise.PropagateUnhandledException(this, ex)
            );
 }
        /// <summary>
        /// Complete the promise. Adds a defualt error handler.
        /// </summary>
        public void Done()
        {
            var resultPromise = new Promise();

            resultPromise.WithName(Name);

            ActionHandlers(resultPromise,
                           () => { },
                           ex => Promise.PropagateUnhandledException(this, ex)
                           );
        }
        /// <summary>
        /// Complete the promise. Adds a default error handler.
        /// </summary>
        public void Done()
        {
            if (CurState == PromiseState.Resolved)
            {
                return;
            }

            Catch(ex =>
                  Promise.PropagateUnhandledException(this, ex)
                  );
        }
        /// <summary>
        /// Completes the promise.
        /// onResolved is called on successful completion.
        /// Adds a default error handler.
        /// </summary>
        public void Done(Action onResolved)
        {
//            Argument.NotNull(() => onResolved);

            var resultPromise = new Promise();

            resultPromise.WithName(Name);

            ActionHandlers(resultPromise,
                           onResolved,
                           ex => Promise.PropagateUnhandledException(this, ex)
                           );
        }
        /// <summary>
        /// Invoke all reject handlers.
        /// </summary>
        void InvokeRejectHandlers(Exception ex)
        {
//            Argument.NotNull(() => ex);

            if (this.rejectHandlers != null)
            {
                this.rejectHandlers.Each(handler => this.InvokeHandler(handler.callback, handler.rejectable, ex));
            }
            else
            {
                Promise.PropagateUnhandledException(this, ex);
            }

            this.ClearHandlers();
        }
Beispiel #6
0
 /// <summary>
 /// Complete the promise. Adds a default error handler.
 /// </summary>
 public void Done()
 {
     if (CurState == PromiseState.Resolved)
     {
         // nothing
     }
     else if (CurState == PromiseState.Rejected)
     {
         Promise.PropagateUnhandledException(this, rejectionException);
     }
     else
     {
         Catch(ex =>
               Promise.PropagateUnhandledException(this, ex)
               );
     }
 }
Beispiel #7
0
 /// <summary>
 /// Complete the promise. Adds a default error handler.
 /// </summary>
 public void Done()
 {
     Catch(ex =>
           Promise.PropagateUnhandledException(this, ex)
           );
 }