PHP function error handling
Written by
Updated at July 2, 2026
If a handler reports a PHP function execution or loading error, the runtime automatically catches the error and returns a JSON document with details of the error type, text, and location. For more information about the JSON document format, see Invoking a function.
The error info is also written to the execution log. You can view the log via the Yandex Cloud CLI or the management console
Example of error handling
Function code:
<?php
function myHandler ($event, $context) {
return undefinedFunction();
}
JSON document returned:
{
"errorMessage": "Call to undefined function undefinedFunction()",
"errorType": "Error",
"stackTrace": [
...
]
}