From a6b966ef0170db38b71277097fdd549b38359d5f Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Mon, 15 Jan 2018 10:28:32 -0800 Subject: [PATCH] Don't use internal name when reporting there's an error in gatsby-node.js fixes #2945 (#3536) * Don't use internal name when reporting there's an error in gatsby-node.js fixes #2945 * Move var initialization into tighter scope * can I code??? --- packages/gatsby/src/utils/api-runner-node.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/gatsby/src/utils/api-runner-node.js b/packages/gatsby/src/utils/api-runner-node.js index 0262c3b948fe9..3b30d5cb82cce 100644 --- a/packages/gatsby/src/utils/api-runner-node.js +++ b/packages/gatsby/src/utils/api-runner-node.js @@ -144,17 +144,20 @@ module.exports = async (api, args = {}, pluginSource) => apisRunning.push(apiRunInstance) - let currentPluginName = null - + let pluginName = null mapSeries( noSourcePluginPlugins, (plugin, callback) => { - currentPluginName = plugin.name + if (plugin.name === `default-site-plugin`) { + pluginName = `gatsby-node.js` + } else { + pluginName = `Plugin ${plugin.name}` + } Promise.resolve(runAPI(plugin, api, args)).asCallback(callback) }, (err, results) => { if (err) { - reporter.error(`Plugin ${currentPluginName} returned an error`, err) + reporter.error(`${pluginName} returned an error`, err) } // Remove runner instance apisRunning = apisRunning.filter(runner => runner !== apiRunInstance)