From c2c5cea7a8066a42bdaa5fc38a8af547242f44f1 Mon Sep 17 00:00:00 2001 From: Antoine Rousseau Date: Wed, 15 May 2019 12:51:33 +0200 Subject: [PATCH] fix(gatsby-source-filesystem): createRemoteFileNode rejects promise instead resolving on failure (#12348) --- .../src/create-remote-file-node.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/gatsby-source-filesystem/src/create-remote-file-node.js b/packages/gatsby-source-filesystem/src/create-remote-file-node.js index 4465ced0f0de4..c190c0ffe9cb6 100644 --- a/packages/gatsby-source-filesystem/src/create-remote-file-node.js +++ b/packages/gatsby-source-filesystem/src/create-remote-file-node.js @@ -105,7 +105,6 @@ async function pushToQueue(task, cb) { const node = await processRemoteNode(task) return cb(null, node) } catch (e) { - console.warn(`Failed to process remote content ${task.url}`) return cb(e) } } @@ -267,8 +266,8 @@ const pushTask = task => .on(`finish`, task => { resolve(task) }) - .on(`failed`, () => { - resolve() + .on(`failed`, err => { + reject(`failed to process ${task.url}\n${err}`) }) }) @@ -327,9 +326,7 @@ module.exports = ({ } if (!url || isWebUri(url) === undefined) { - // should we resolve here, or reject? - // Technically, it's invalid input - return Promise.resolve() + return Promise.reject(`wrong url: ${url}`) } totalJobs += 1