@openinc/parse-server-opendash
Version:
Parse Server Cloud Code for open.INC Stack.
8 lines (7 loc) • 461 B
TypeScript
/**
* Catch errors from a promise and return them as an array or the result
* @param promise A promise to catch errors from
* @param errorsToCatch An array of error classes to catch. If not provided, all errors will be caught.
* @returns The promise result or an array with the error
*/
export declare function catchError<T, E extends new (Message?: string) => Error>(promise: Promise<T>, errorsToCatch?: E[]): Promise<[undefined, T] | [InstanceType<E>]>;