import { ErrorStrategyHandlers } from '../handled-api/common'; import { BadRequestError, UnauthorizedError, AnythingButUndefined, TooManyRequestsError, NotFoundError, ServerError, HttpError, UnexpectedError, ForbiddenError } from '@avst-api/commons'; import { AtlassianErrorResponse } from '../common'; export declare class ErrorStrategyBuilder { private options; constructor(options?: ErrorStrategyHandlers); static create(): ErrorStrategyBuilder; /** * Error handler for HTTP code 400 (Bad Request). Return the value you whish to continue with, or return 'retry()' for retrying the request, or return 'continuePropagation()' for allowing the error to propagate. */ http400Error(handler: (error: BadRequestError, attempt: number) => AnythingButUndefined): ErrorStrategyBuilder; /** * Error handler for HTTP code 401 (Unauthorized). Return the value you whish to continue with, or return 'retry()' for retrying the request, or return 'continuePropagation()' for allowing the error to propagate. */ http401Error(handler: (error: UnauthorizedError, attempt: number) => AnythingButUndefined): ErrorStrategyBuilder; /** * Error handler for HTTP code 403 (Forbidden). Return the value you whish to continue with, or return 'retry()' for retrying the request, or return 'continuePropagation()' for allowing the error to propagate. */ http403Error(handler: (error: ForbiddenError, attempt: number) => AnythingButUndefined): ErrorStrategyBuilder; /** * Error handler for HTTP code 404 (Not Found). Return the value you whish to continue with, or return 'retry()' for retrying the request, or return 'continuePropagation()' for allowing the error to propagate. */ http404Error(handler: (error: NotFoundError, attempt: number) => AnythingButUndefined): ErrorStrategyBuilder; /** * Error handler for HTTP code 429 (Too Many Requests). Return the value you whish to continue with, or return 'retry()' for retrying the request, or return 'continuePropagation()' for allowing the error to propagate. */ http429Error(handler: (error: TooManyRequestsError, attempt: number) => AnythingButUndefined): ErrorStrategyBuilder; /** * Error handler for any HTTP code in 500 range (various server side errors). Return the value you whish to continue with, or return 'retry()' for retrying the request, or return 'continuePropagation()' for allowing the error to propagate. */ http5xxError(handler: (error: ServerError, attempt: number) => AnythingButUndefined): ErrorStrategyBuilder; /** * Error handler for any invalid HTTP code (anything other than in 200 and 300 range). Return the value you whish to continue with, or return 'retry()' for retrying the request, or return 'continuePropagation()' for allowing the error to propagate. */ httpAnyError(handler: (error: HttpError, attempt: number) => AnythingButUndefined): ErrorStrategyBuilder; /** * Error handler for unexpected error, usually either network error or JSON parsing error. Return the value you whish to continue with, or return 'retry()' for retrying the request, or return 'continuePropagation()' for allowing the error to propagate. */ unexpectedError(handler: (error: UnexpectedError, attempt: number) => AnythingButUndefined): ErrorStrategyBuilder; /** * Error handler for any error. Return the value you whish to continue with, or return 'retry()' for retrying the request, or return 'continuePropagation()' for allowing the error to propagate. */ anyError(handler: (error: HttpError | UnexpectedError, attempt: number) => AnythingButUndefined): ErrorStrategyBuilder; /** * Retry when HTTP request is being rate limited (429 response). * @param total How many times to re-try. Default: 5. * @param delay How long to delay before re-trying again, in milliseconds. Default: 1 second. * @param delayIncrease Delay to increase per each unsuccessful re-try, in milliseconds. Default: 1 second. */ retryOnRateLimiting(total?: number, delay?: number, delayIncrease?: number): ErrorStrategyBuilder; /** * Retry on any HTTP error. * @param total How many times to re-try. Default: 5. * @param delay How long to delay before re-trying again, in milliseconds. Default: 1 second. * @param delayIncrease Delay to increase per each unsuccessful re-try, in milliseconds. Default: 1 second. */ retryOnHttpError(total?: number, delay?: number, delayIncrease?: number): ErrorStrategyBuilder; /** * Retry on any failure. * @param total How many times to re-try. Default: 5. * @param delay How long to delay before re-trying again, in milliseconds. Default: 1 second. * @param delayIncrease Delay to increase per each unsuccessful re-try, in milliseconds. Default: 1 second. */ retryOnAnyError(total?: number, delay?: number, delayIncrease?: number): ErrorStrategyBuilder; build(): ErrorStrategyHandlers; } //# sourceMappingURL=errorStrategy.d.ts.map