Documentation about callback and returning proper error responses
Opened this issue · 0 comments
monis0395 commented
Hi,
I was using FunctionScript in stdlib, I had a hard time finding about the callback
function definition and how to return caught errors properly in case of sync and async functions.
Ultimately looking at the testcases and code in lib/gateway.js
I was able to confirm
- callback definition is callback(error, body, header)
- in async function there is no way to return error, we just have to throw them, which would be caught
execute
to send a proper error response to client
So it would be a lot helpful if we add these details in documentation.
PS: Thanks for putting testcases!