Handling errors
If a handler reports a runtime or loading error, the runtime environment automatically captures the error and returns a JSON document with details of the error type, text, and location in the response. For more information about the JSON document format, see Calling a function.
The error data is also written to the execution log. You can view it using the YC CLI or management console.
Example of error handling
Function code:
module.exports.handler = function () {
return unknownVariable;
};
JSON document returned:
{
"errorMessage": "unknownVariable is not defined",
"errorType": "ReferenceError",
"stackTrace": [
...
]
}