@cumulus/aws-client
Version:
Utilities for working with AWS
29 lines • 1.37 kB
TypeScript
import pRetry from 'p-retry';
export declare const getServiceIdentifer: (service: any) => any;
export declare const setErrorStack: (error: Error, newStack: string) => void;
/**
* Wrap a function and provide a better stack trace
*
* If a call is made to the aws-sdk and it causes an exception, the stack trace
* that is returned gives no indication of where the error actually occurred.
*
* This utility will wrap a function and, when it is called, update any raised
* error with a better stack trace.
*
* @private
*/
export declare const improveStackTrace: <T, U extends unknown[]>(fn: (...args: U) => Promise<T>) => (...args: U) => Promise<T>;
/**
* Wrap a function so that it will retry when a ThrottlingException is encountered.
*
* @param {Function} fn - the function to retry. This function must return a Promise.
* @param {Object} options - retry options, documented here:
* - https://github.com/sindresorhus/p-retry#options
* - https://github.com/tim-kos/node-retry#retryoperationoptions
* - https://github.com/tim-kos/node-retry#retrytimeoutsoptions
* @returns {Function} a function that will retry on a ThrottlingException
*
* @private
*/
export declare const retryOnThrottlingException: <T, U extends unknown[]>(fn: (...args: U) => Promise<T>, options?: pRetry.Options) => (...args: U) => Promise<T>;
//# sourceMappingURL=utils.d.ts.map