From 2129135714b63c1b62696f65e4b644f98ff37ae0 Mon Sep 17 00:00:00 2001 From: Jason Jean Date: Wed, 5 Feb 2025 13:03:55 -0500 Subject: [PATCH] chore(core): handle project graph errors which do not have a message (#29893) ## Current Behavior When weird errors which do not have a message get thrown, a weird error gets thrown by Nx saying cannot read `split` of `undefined`. ## Expected Behavior When weird errors which do not have a message get thrown, the weird error is `console.error`ed ## Related Issue(s) Fixes # --- packages/nx/src/project-graph/project-graph.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/nx/src/project-graph/project-graph.ts b/packages/nx/src/project-graph/project-graph.ts index 1d06798f8a0fa..5f5e59584cc9c 100644 --- a/packages/nx/src/project-graph/project-graph.ts +++ b/packages/nx/src/project-graph/project-graph.ts @@ -198,7 +198,7 @@ export function handleProjectGraphError(opts: { exitOnError: boolean }, e) { title, bodyLines: bodyLines, }); - } else { + } else if (typeof e.message === 'string') { const lines = e.message.split('\n'); output.error({ title: lines[0], @@ -207,6 +207,8 @@ export function handleProjectGraphError(opts: { exitOnError: boolean }, e) { if (isVerbose) { console.error(e); } + } else { + console.error(e); } process.exit(1); } else {