From f43e0fcd7d4821eab3da93d27772ad7e9d74f743 Mon Sep 17 00:00:00 2001 From: Vladyslav Hrytsenko Date: Thu, 24 Oct 2024 17:17:01 +0300 Subject: [PATCH] added separate update on error send --- packages/nexrender-core/src/tasks/render.js | 1 - packages/nexrender-worker/src/instance.js | 14 ++++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/nexrender-core/src/tasks/render.js b/packages/nexrender-core/src/tasks/render.js index 8937eb35..ba137e2a 100644 --- a/packages/nexrender-core/src/tasks/render.js +++ b/packages/nexrender-core/src/tasks/render.js @@ -206,7 +206,6 @@ Estimated date of change to the new behavior: 2023-06-01.\n`); job.onRenderError(job, new Error(matchError[1])); } errorSent = true - throw new Error(matchError[1]); } return data; diff --git a/packages/nexrender-worker/src/instance.js b/packages/nexrender-worker/src/instance.js index c006431d..97bff2cd 100644 --- a/packages/nexrender-worker/src/instance.js +++ b/packages/nexrender-worker/src/instance.js @@ -179,14 +179,16 @@ const createWorker = () => { } } })(client, settings); + currentJob.onRenderError = ((c, s, job) => (_, err) => { + job.error = [].concat(job.error || [], [err.toString()]); - currentJob.onRenderError = (currentJob, err /* on render error */) => { - currentJob.error = [].concat(currentJob.error || [], [err.toString()]); - - if (settings.onRenderError) { - settings.onRenderError(currentJob, err); + if (s.onRenderError) { + s.onRenderError(job, err); } - } + + /* send render progress to our server */ + c.updateJob(job.uid, getRenderingStatus(job)); + })(client, settings, currentJob); currentJob = await render(currentJob, settings); { currentJob.state = 'finished';