using System; using System.Reflection; namespace Implab { public class FailedPromise : FailedPromise, IPromise { public FailedPromise(Exception error) : base(error) { } public IPromise On(Action success, Action error, Action cancel) { if (error != null) { try { error(RejectReason); // Analysis disable once EmptyGeneralCatchClause } catch { } } return this; } public IPromise On(Action success, Action error) { if (error != null) { try { error(RejectReason); // Analysis disable once EmptyGeneralCatchClause } catch { } } return this; } public IPromise On(Action success) { return this; } T IPromise.Join() { throw new TargetInvocationException(RejectReason); } T IPromise.Join(int timeout) { throw new TargetInvocationException(RejectReason); } IPromise IPromise.On(Action success, Action error, Action cancel) { On(success, error, cancel); return this; } IPromise IPromise.On(Action success, Action error) { On(success, error); return this; } IPromise IPromise.On(Action success) { On(success); return this; } IPromise IPromise.On(Action handler, PromiseEventType events) { On(handler, events); return this; } } }