From 9cda5071d0186413c93bc1b5760ceb1ec656db83 Mon Sep 17 00:00:00 2001 From: Andrey Melikhov Date: Fri, 10 Jan 2025 18:41:51 +0300 Subject: [PATCH] Small refactoring fo common runner --- .../components/charts-engine/runners/common.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/server/components/charts-engine/runners/common.ts b/src/server/components/charts-engine/runners/common.ts index 7787a0c085..082d61cec5 100644 --- a/src/server/components/charts-engine/runners/common.ts +++ b/src/server/components/charts-engine/runners/common.ts @@ -48,8 +48,10 @@ function engineProcessingCallback({ res.setHeader('chart-runner-type', runnerType); if (result) { - // TODO use ShowChartsEngineDebugInfo flag - if ('logs_v2' in result && (!res.locals.editMode || !showChartsEngineDebugInfo)) { + if ( + 'logs_v2' in result && + (!processorParams.isEditMode || !showChartsEngineDebugInfo) + ) { delete result.logs_v2; } @@ -141,9 +143,6 @@ function engineProcessingCallback({ res.status(error.statusCode || 500).send(result); } - }) - .finally(() => { - ctx.end(); }); } @@ -297,7 +296,9 @@ export function commonRunner({ }) .catch((error) => { ctx.logError('CHARTS_ENGINE_PROCESSOR_UNHANDLED_ERROR', error); - ctx.end(); res.status(500).send('Internal error'); + }) + .finally(() => { + ctx.end(); }); }