From ef582c5b4dd578f7af22406dc629e79cdf7c319e Mon Sep 17 00:00:00 2001 From: Brian Broll Date: Fri, 10 Apr 2020 10:21:14 -0500 Subject: [PATCH] More verbose error logs on data retrieval err. Closes #1632 --- src/plugins/GenerateJob/templates/start.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/plugins/GenerateJob/templates/start.js b/src/plugins/GenerateJob/templates/start.js index 0879b2132..7a16db4f1 100644 --- a/src/plugins/GenerateJob/templates/start.js +++ b/src/plugins/GenerateJob/templates/start.js @@ -24,6 +24,12 @@ logger.fork = () => logger; let remainingImageCount = 0; let exitCode; +class DataRetrievalError extends Error { + constructor(name, err) { + const message = `Data retrieval failed for ${name}: ${err}`; + super(message); + } +} const requirejs = require('requirejs'); requirejs([ @@ -77,13 +83,18 @@ requirejs([ await prepareInputsOutputs(); try { const fetchData = inputData - .map(tuple => { + .map(async tuple => { const [path, dataInfo, config] = tuple; - return getData(workerCacheDir, path, dataInfo, config); + try { + await getData(workerCacheDir, path, dataInfo, config); + } catch (err) { + const [, inputName] = path.split('/'); + throw new DataRetrievalError(inputName, err); + } }); await Promise.all(fetchData); } catch (err) { - console.log(`Data retrieval failed: ${err}`); + console.log(err.message); process.exit(1); }