Add missing error-handling methods

* also added the inspect method (https://github.com/cujojs/when/blob/master/docs/api.md#inspect)
This commit is contained in:
Derek Cicerone
2014-01-23 15:13:41 -05:00
parent 950d0d85a7
commit 6aa70b2cc5
+14
View File
@@ -55,11 +55,25 @@ declare module When {
}
interface Promise<T> {
catch<U>(onRejected?: (reason: any) => Promise<U>): Promise<U>;
catch<U>(onRejected?: (reason: any) => U): Promise<U>;
ensure(onFulfilledOrRejected: Function): Promise<T>;
inspect(): Snapshot<T>;
otherwise<U>(onRejected?: (reason: any) => Promise<U>): Promise<U>;
otherwise<U>(onRejected?: (reason: any) => U): Promise<U>;
then<U>(onFulfilled: (value: T) => Promise<U>, onRejected?: (reason: any) => Promise<U>, onProgress?: (update: any) => void): Promise<U>;
then<U>(onFulfilled: (value: T) => Promise<U>, onRejected?: (reason: any) => U, onProgress?: (update: any) => void): Promise<U>;
then<U>(onFulfilled: (value: T) => U, onRejected?: (reason: any) => Promise<U>, onProgress?: (update: any) => void): Promise<U>;
then<U>(onFulfilled: (value: T) => U, onRejected?: (reason: any) => U, onProgress?: (update: any) => void): Promise<U>;
}
interface Snapshot<T> {
state: string;
value?: T;
reason?: any;
}
}