Skip to content

Commit

Permalink
v2.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dherault committed Mar 30, 2016
1 parent 3ff3719 commit 4322548
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "serverless-offline",
"version": "2.2.0",
"version": "2.2.1",
"description": "Emulate AWS λ and API Gateway locally when developing your Serverless project",
"main": "src/index.js",
"scripts": {},
Expand Down
8 changes: 6 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,12 @@ module.exports = S => {
const x = handler(event, lambdaContext);

// Promise support
if (funRuntime === 'babel' && typeof x.then === 'function' && typeof x.catch === 'function') {
x.then(lambdaContext.succeed).catch(lambdaContext.fail);
if (funRuntime === 'babel') {
if (x && typeof x.then === 'function' && typeof x.catch === 'function') x
.then(lambdaContext.succeed)
.catch(lambdaContext.fail);
else if (x instanceof Error) lambdaContext.fail(x);
else lambdaContext.succeed(x);
}
}
catch(err) {
Expand Down

0 comments on commit 4322548

Please sign in to comment.