sqs-consumer
Version:
Build SQS-based Node applications without the boilerplate
56 lines (55 loc) • 2.07 kB
TypeScript
import type { Message } from "@aws-sdk/client-sqs";
import type { AWSError } from "./types.js";
declare class SQSError extends Error {
code?: string;
cause?: unknown;
statusCode?: number;
service?: string;
time?: Date;
retryable?: boolean;
fault?: AWSError["$fault"];
response?: AWSError["$response"];
metadata?: AWSError["$metadata"];
queueUrl?: string;
messageIds?: string[];
constructor(message: string);
}
declare class TimeoutError extends Error {
messageIds: string[];
cause?: Error;
time?: Date;
constructor(message?: string);
}
declare class StandardError extends Error {
messageIds: string[];
cause?: Error;
time?: Date;
constructor(message?: string);
}
/**
* Checks if the error provided should be treated as a connection error.
* @param err The error that was received.
*/
declare function isConnectionError(err: Error): boolean;
declare function toError(err: unknown): Error;
/**
* Formats an AWSError the the SQSError type.
* @param err The error object that was received.
* @param message The message to send with the error.
*/
declare function toSQSError(err: unknown, message: string, extendedAWSErrors: boolean, queueUrl?: string, sqsMessage?: Message | Message[]): SQSError;
/**
* Formats an Error to the StandardError type.
* @param err The error object that was received.
* @param message The message to send with the error.
* @param sqsMessage The message that was received from SQS.
*/
declare function toStandardError(err: Error, message: string, sqsMessage: Message | Message[]): StandardError;
/**
* Formats an Error to the TimeoutError type.
* @param err The error object that was received.
* @param message The message to send with the error.
* @param sqsMessage The message that was received from SQS.
*/
declare function toTimeoutError(err: TimeoutError, message: string, sqsMessage: Message | Message[]): TimeoutError;
export { SQSError, StandardError, TimeoutError, isConnectionError, toSQSError, toStandardError, toTimeoutError, toError, };