From 38c92532f3b6a84aca778036c0bdf036e6d96fb1 Mon Sep 17 00:00:00 2001 From: Michal Piechowiak Date: Thu, 7 Feb 2019 13:27:55 +0100 Subject: [PATCH] fix(gatsby): add sanity check before displaying path for static html build error --- packages/gatsby/src/commands/build.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/gatsby/src/commands/build.js b/packages/gatsby/src/commands/build.js index bf41babab4f97..eab68a6a2b915 100644 --- a/packages/gatsby/src/commands/build.js +++ b/packages/gatsby/src/commands/build.js @@ -61,7 +61,11 @@ module.exports = async function build(program: BuildArgs) { await buildHTML(program, activity).catch(err => { reportFailure( report.stripIndent` - Building static HTML failed for path "${chalk.bold(err.context.path)}" + Building static HTML failed${ + err.context && err.context.path + ? ` for path "${chalk.bold(err.context.path)}"` + : `` + } See our docs page on debugging HTML builds for help https://gatsby.app/debug-html `,