Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@crawly/handler-exception-lambda

Package Overview
Dependencies
Maintainers
3
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@crawly/handler-exception-lambda - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

4

dist/index.js

@@ -53,3 +53,5 @@ "use strict";

exports.getErrorResponse = function (error) {
var messages = [error.message];
var messages = error.messages && Array.isArray(error.messages)
? error.messages
: [error.message];
var statusCode = error.statusCode ? error.statusCode : 500;

@@ -56,0 +58,0 @@ var timeoutCauses = ['ECONNRESET', 'ESOCKETTIMEDOUT'];

{
"name": "@crawly/handler-exception-lambda",
"version": "0.2.0",
"version": "0.2.1",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "types": "dist/index.d.ts",

@@ -68,3 +68,6 @@ import * as Raven from 'raven';

export const getErrorResponse = (error: any): ErrorResponse => {
const messages = [error.message];
const messages = error.messages && Array.isArray(error.messages)
? error.messages
: [error.message];
let statusCode = error.statusCode ? error.statusCode : 500;

@@ -71,0 +74,0 @@

@@ -343,2 +343,12 @@ import { expect } from 'chai';

});
it('Use messages if exists to generate messages', () => {
const errorsMessages = Array(5).fill('').map(() => faker.lorem.words());
const error = new ErrorWithMessages(errorsMessages);
const errorResponse = getErrorResponse(error);
expect(errorResponse).to.have.property('messages')
.and.to.be.deep.equal(errorsMessages);
});
});

@@ -370,1 +380,11 @@ });

}
class ErrorWithMessages extends Error {
public messages: string[];
constructor(messages: string[], message?: string) {
super(message);
this.messages = messages;
}
}
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