-
-
Save nazreen/814788d6e53609097f11e330d9387ae6 to your computer and use it in GitHub Desktop.
2019-04-16 process.on('unresolvedPromise')
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in index.js | |
... | |
async function handler(event, context) { | |
try { | |
return handlerService.call(event, context, { AWS }) | |
} catch (e) { | |
if (process.env.NODE_ENV === 'local') throw e | |
throw JSON.stringify(e) | |
} | |
} | |
// process.on('unresolvedPromise', err => { | |
// console.error(err.toString()) | |
// process.exit(1) | |
// }) | |
exports.handler = handler | |
// handlerServices.js | |
... | |
async function call(event, context, options) { | |
throw new Error('test') | |
if (!options.AWS) { | |
throw new Error('Please pass your AWS instance via the "AWS" option.') | |
} | |
... | |
// lambda input is irrelevant since we throw on first line | |
// result: | |
{ | |
"errorMessage": "test", | |
"errorType": "Error", | |
"stackTrace": [ | |
"Object.call (/var/task/handlers/handlerService.js:7:9)", | |
"handler (/var/task/index.js:8:27)" | |
] | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment