Skip to content

Commit

Permalink
Don't use internal name when reporting there's an error in gatsby-nod…
Browse files Browse the repository at this point in the history
…e.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???
  • Loading branch information
KyleAMathews authored Jan 15, 2018
1 parent 936c33a commit a6b966e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/gatsby/src/utils/api-runner-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a6b966e

Please sign in to comment.