1
0
Fork 0
mirror of synced 2024-07-05 14:40:42 +12:00

Improve logs

This commit is contained in:
Matej Bačo 2023-05-24 18:29:23 +02:00
parent 0368cdb669
commit 1762c4f491

View file

@ -40,6 +40,8 @@ Server::setResource('execute', function () {
string $eventData = null, string $eventData = null,
string $executionId = null, string $executionId = null,
) { ) {
$error = null; // Used to re-throw at the end to trigger Logger (Sentry)
$user ??= new Document(); $user ??= new Document();
$functionId = $function->getId(); $functionId = $function->getId();
$deploymentId = $function->getAttribute('deployment', ''); $deploymentId = $function->getAttribute('deployment', '');
@ -157,6 +159,8 @@ Server::setResource('execute', function () {
Console::error($th->getFile()); Console::error($th->getFile());
Console::error($th->getLine()); Console::error($th->getLine());
Console::error($th->getMessage()); Console::error($th->getMessage());
$error = $th->getMessage();
} }
$execution = $dbForProject->updateDocument('executions', $executionId, $execution); $execution = $dbForProject->updateDocument('executions', $executionId, $execution);
@ -217,6 +221,11 @@ Server::setResource('execute', function () {
->setParam('networkResponseSize', 0) ->setParam('networkResponseSize', 0)
->submit(); ->submit();
} }
if(!empty($error)) {
$projectId = $project->getId();
throw new Exception("Error in project #{$projectId}, function #{$functionId}: " . $error);
}
}; };
}); });