Socket
Socket
Sign inDemoInstall

sqs-consumer

Package Overview
Dependencies
Maintainers
2
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sqs-consumer - npm Package Compare versions

Comparing version 7.4.0 to 7.5.0-canary.0

6

dist/consumer.js

@@ -353,6 +353,6 @@ "use strict";

if (err instanceof errors_1.TimeoutError) {
err.message = `Message handler timed out after ${this.handleMessageTimeout}ms: Operation timed out.`;
throw (0, errors_1.toTimeoutError)(err, `Message handler timed out after ${this.handleMessageTimeout}ms: Operation timed out.`);
}
else if (err instanceof Error) {
err.message = `Unexpected message handler failure: ${err.message}`;
throw (0, errors_1.toStandardError)(err, `Unexpected message handler failure: ${err.message}`);
}

@@ -378,3 +378,3 @@ throw err;

if (err instanceof Error) {
err.message = `Unexpected message handler failure: ${err.message}`;
throw (0, errors_1.toStandardError)(err, `Unexpected message handler failure: ${err.message}`);
}

@@ -381,0 +381,0 @@ throw err;

@@ -12,4 +12,11 @@ import { AWSError } from './types';

declare class TimeoutError extends Error {
cause: Error;
time: Date;
constructor(message?: string);
}
declare class StandardError extends Error {
cause: Error;
time: Date;
constructor(message?: string);
}
/**

@@ -23,5 +30,17 @@ * Checks if the error provided should be treated as a connection error.

* @param err The error object that was received.
* @param message The message that the error occurred on.
* @param message The message to send with the error.
*/
declare function toSQSError(err: AWSError, message: string): SQSError;
export { SQSError, TimeoutError, isConnectionError, toSQSError };
/**
* Formats an Error to the StandardError type.
* @param err The error object that was received.
* @param message The message to send with the error.
*/
declare function toStandardError(err: Error, message: string): 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.
*/
declare function toTimeoutError(err: TimeoutError, message: string): TimeoutError;
export { SQSError, TimeoutError, isConnectionError, toSQSError, toStandardError, toTimeoutError };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toSQSError = exports.isConnectionError = exports.TimeoutError = exports.SQSError = void 0;
exports.toTimeoutError = exports.toStandardError = exports.toSQSError = exports.isConnectionError = exports.TimeoutError = exports.SQSError = void 0;
class SQSError extends Error {

@@ -19,2 +19,9 @@ constructor(message) {

exports.TimeoutError = TimeoutError;
class StandardError extends Error {
constructor(message = 'An unexpected error occurred:') {
super(message);
this.message = message;
this.name = 'StandardError';
}
}
/**

@@ -37,3 +44,3 @@ * Checks if the error provided should be treated as a connection error.

* @param err The error object that was received.
* @param message The message that the error occurred on.
* @param message The message to send with the error.
*/

@@ -52,1 +59,25 @@ function toSQSError(err, message) {

exports.toSQSError = toSQSError;
/**
* Formats an Error to the StandardError type.
* @param err The error object that was received.
* @param message The message to send with the error.
*/
function toStandardError(err, message) {
const error = new StandardError(message);
error.cause = err;
error.time = new Date();
return error;
}
exports.toStandardError = toStandardError;
/**
* Formats an Error to the TimeoutError type.
* @param err The error object that was received.
* @param message The message to send with the error.
*/
function toTimeoutError(err, message) {
const error = new TimeoutError(message);
error.cause = err;
error.time = new Date();
return error;
}
exports.toTimeoutError = toTimeoutError;

@@ -122,3 +122,3 @@ import { SQSClient, Message } from '@aws-sdk/client-sqs';

}
export type UpdatableOptions = 'visibilityTimeout' | 'batchSize' | 'waitTimeSeconds';
export type UpdatableOptions = 'visibilityTimeout' | 'batchSize' | 'waitTimeSeconds' | 'pollingWaitTimeMs';
export interface StopOptions {

@@ -125,0 +125,0 @@ /**

@@ -33,2 +33,7 @@ "use strict";

break;
case 'pollingWaitTimeMs':
if (value < 0) {
throw new Error('pollingWaitTimeMs must be greater than 0.');
}
break;
default:

@@ -35,0 +40,0 @@ if (strict) {

{
"name": "sqs-consumer",
"version": "7.4.0",
"version": "7.5.0-canary.0",
"description": "Build SQS-based Node applications without the boilerplate",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -132,2 +132,4 @@ # sqs-consumer

Please note that any update of the option `pollingWaitTimeMs` will take effect only on next polling cycle.
You can [find out more about this here](https://bbc.github.io/sqs-consumer/classes/Consumer.html#updateOption).

@@ -134,0 +136,0 @@

@@ -25,2 +25,4 @@ import {

TimeoutError,
toStandardError,
toTimeoutError,
toSQSError,

@@ -457,5 +459,11 @@ isConnectionError

if (err instanceof TimeoutError) {
err.message = `Message handler timed out after ${this.handleMessageTimeout}ms: Operation timed out.`;
throw toTimeoutError(
err,
`Message handler timed out after ${this.handleMessageTimeout}ms: Operation timed out.`
);
} else if (err instanceof Error) {
err.message = `Unexpected message handler failure: ${err.message}`;
throw toStandardError(
err,
`Unexpected message handler failure: ${err.message}`
);
}

@@ -481,3 +489,6 @@ throw err;

if (err instanceof Error) {
err.message = `Unexpected message handler failure: ${err.message}`;
throw toStandardError(
err,
`Unexpected message handler failure: ${err.message}`
);
}

@@ -484,0 +495,0 @@ throw err;

@@ -18,2 +18,5 @@ import { AWSError } from './types';

class TimeoutError extends Error {
cause: Error;
time: Date;
constructor(message = 'Operation timed out.') {

@@ -26,2 +29,13 @@ super(message);

class StandardError extends Error {
cause: Error;
time: Date;
constructor(message = 'An unexpected error occurred:') {
super(message);
this.message = message;
this.name = 'StandardError';
}
}
/**

@@ -46,3 +60,3 @@ * Checks if the error provided should be treated as a connection error.

* @param err The error object that was received.
* @param message The message that the error occurred on.
* @param message The message to send with the error.
*/

@@ -61,2 +75,35 @@ function toSQSError(err: AWSError, message: string): SQSError {

export { SQSError, TimeoutError, isConnectionError, toSQSError };
/**
* Formats an Error to the StandardError type.
* @param err The error object that was received.
* @param message The message to send with the error.
*/
function toStandardError(err: Error, message: string): StandardError {
const error = new StandardError(message);
error.cause = err;
error.time = new Date();
return error;
}
/**
* Formats an Error to the TimeoutError type.
* @param err The error object that was received.
* @param message The message to send with the error.
*/
function toTimeoutError(err: TimeoutError, message: string): TimeoutError {
const error = new TimeoutError(message);
error.cause = err;
error.time = new Date();
return error;
}
export {
SQSError,
TimeoutError,
isConnectionError,
toSQSError,
toStandardError,
toTimeoutError
};

@@ -127,3 +127,4 @@ import { SQSClient, Message } from '@aws-sdk/client-sqs';

| 'batchSize'
| 'waitTimeSeconds';
| 'waitTimeSeconds'
| 'pollingWaitTimeMs';

@@ -130,0 +131,0 @@ export interface StopOptions {

@@ -48,2 +48,7 @@ import { ReceiveMessageCommandOutput } from '@aws-sdk/client-sqs';

break;
case 'pollingWaitTimeMs':
if (value < 0) {
throw new Error('pollingWaitTimeMs must be greater than 0.');
}
break;
default:

@@ -50,0 +55,0 @@ if (strict) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc