From 1762c4f4916308d155ff565db6475ab6687c65b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 24 May 2023 18:29:23 +0200 Subject: [PATCH] Improve logs --- app/workers/functions.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/workers/functions.php b/app/workers/functions.php index 31e64a2bb4..1e1a75d92b 100644 --- a/app/workers/functions.php +++ b/app/workers/functions.php @@ -40,6 +40,8 @@ Server::setResource('execute', function () { string $eventData = null, string $executionId = null, ) { + $error = null; // Used to re-throw at the end to trigger Logger (Sentry) + $user ??= new Document(); $functionId = $function->getId(); $deploymentId = $function->getAttribute('deployment', ''); @@ -157,6 +159,8 @@ Server::setResource('execute', function () { Console::error($th->getFile()); Console::error($th->getLine()); Console::error($th->getMessage()); + + $error = $th->getMessage(); } $execution = $dbForProject->updateDocument('executions', $executionId, $execution); @@ -217,6 +221,11 @@ Server::setResource('execute', function () { ->setParam('networkResponseSize', 0) ->submit(); } + + if(!empty($error)) { + $projectId = $project->getId(); + throw new Exception("Error in project #{$projectId}, function #{$functionId}: " . $error); + } }; });