🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

lambda-error-handler

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lambda-error-handler

Error handling decorator for AWS Lambda functions when used with the Serverless framework

latest
Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
10
25%
Maintainers
1
Weekly downloads
 
Created
Source

lambda-error-handler

Error handling decorator for AWS Lambda functions when used with the Serverless framework

Usage

This library exposes a decorator function that is used to wrap an async AWS Lambda function in node.js to provide error handling for that lambda. This allows you to leave the catching of an error and the correct formatting of the response in that situation to this decorator.

First you need to install this library:

yarn add lambda-error-handler

Then you can use it like so:

"use strict";

const withErrorHandling = require("lambda-error-handler");

async function handler(event) {
  // some real content here
  return { body: "some result" };
}

module.exports.handler = withErrorHandling(handler);

Changelog

  • v1.1.0: Added content type header to error response.

License

MIT

Keywords

lambda

FAQs

Package last updated on 31 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts