0.0.6 • Published 7 years ago

lambda-error v0.0.6

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

AWS Lambda Error

Travis Commitizen friendly npm npm Codecov

If you plan to use Node.js in an AWS Lambda function with an AWS API Gateway and need to have streamlined error objects for easy response parsing, just use lambda-error:

var lambdaErr = require('lambda-error');

exports.handle = function(e, ctx, callback) {
  if (!e.name) {
    return callback(
      lambdaErr.BadRequest('Missing name').toString()
    );
  }
  
  ctx.succeed({name: e.name, found: true});
};
var lambdaErr = require('lambda-error');

exports.handle = function(e, ctx, callback) {
  if (!e.name) {
    return callback(
      lambdaErr.BadRequest('Missing name').withContext(ctx).toString()
    );
  }
  
  ctx.succeed({name: e.name, found: true});
};

Available error codes

  • BadRequest (400)
  • Forbidden (403)
  • NotFound (404)
  • Conflict (409)
  • InternalServerError (500)
0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago