Skip to content

Commit a6b966e

Browse files
authored
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???
1 parent 936c33a commit a6b966e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

packages/gatsby/src/utils/api-runner-node.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,17 +144,20 @@ module.exports = async (api, args = {}, pluginSource) =>
144144

145145
apisRunning.push(apiRunInstance)
146146

147-
let currentPluginName = null
148-
147+
let pluginName = null
149148
mapSeries(
150149
noSourcePluginPlugins,
151150
(plugin, callback) => {
152-
currentPluginName = plugin.name
151+
if (plugin.name === `default-site-plugin`) {
152+
pluginName = `gatsby-node.js`
153+
} else {
154+
pluginName = `Plugin ${plugin.name}`
155+
}
153156
Promise.resolve(runAPI(plugin, api, args)).asCallback(callback)
154157
},
155158
(err, results) => {
156159
if (err) {
157-
reporter.error(`Plugin ${currentPluginName} returned an error`, err)
160+
reporter.error(`${pluginName} returned an error`, err)
158161
}
159162
// Remove runner instance
160163
apisRunning = apisRunning.filter(runner => runner !== apiRunInstance)

0 commit comments

Comments
 (0)