Replies: 3 comments
-
Maybe something like:
|
Beta Was this translation helpful? Give feedback.
-
@hugosenari Thanks for joining this discussion! On try/catch or setting control flow, at the moment one of the philosophy I'm trying to encourage is use JavaScript as close as possible. Control flow like try/catch is a JavaScript syntax, I think a middleware can be introduced to tackle this. I think it's quite similar to |
Beta Was this translation helpful? Give feedback.
-
Maybe we could implement everything as HOF adapter and see what makes sense move to core. const myAdapter = hofAdapter({
mappings: [getBody],
onEnd: result => result,
onSuccess: identity,
throwMillisBeforeTimeout: 500,
onError: error => { throw error; }
});
exports.handler = laconia(myAdapter(body => ({ data: body }))); Until we could do this: module.exports = laconia(body => ({ data: body }))
.on('end', () => {})
.on('mapping', getBody)
.on('success', result => result)
.on('error', error => { throw error; )
.on('beforeTimeout': timeroutErrorHandler); |
Beta Was this translation helpful? Give feedback.
-
Recently I've got a use case of trying to execute something before a Lambda times out. This made me think of a lifecycle that I should have been able to listen to, for example, it may look like this:
Discussion
Beta Was this translation helpful? Give feedback.
All reactions