in src/Invoker.php [83:108]
public function handle(
ServerRequestInterface $request = null
): ResponseInterface {
if ($request === null) {
$request = ServerRequest::fromGlobals();
}
try {
return $this->function->execute($request);
} catch (BadRequestError $e) {
// Log the full error and stack trace
($this->errorLogFunc)((string) $e);
return new Response(400, [], 'Bad Request');
} catch (Exception $e) {
// Log the full error and stack trace
($this->errorLogFunc)((string) $e);
// Set "X-Google-Status" to "crash" for Http functions and "error"
// for Cloud Events
$statusHeader = $this->function instanceof HttpFunctionWrapper
? 'crash'
: 'error';
return new Response(500, [
FunctionWrapper::FUNCTION_STATUS_HEADER => $statusHeader,
]);
}
}