UNPKG

sqs-consumer

Version:

Build SQS-based Node applications without the boilerplate

54 lines (53 loc) 1.97 kB
import { Message } from "@aws-sdk/client-sqs"; import { AWSError } from "./types.js"; declare class SQSError extends Error { code: string; 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; /** * 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: AWSError, 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, };