From 6d0bbee9e7805949f94bcf88a7392d6d7cdd3340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivens=20Diego=20M=C3=BCller?= Date: Wed, 29 May 2024 07:00:25 -0300 Subject: [PATCH] fix(release): improve error handling for npm publish (#26159) --- .../executors/release-publish/release-publish.impl.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/js/src/executors/release-publish/release-publish.impl.ts b/packages/js/src/executors/release-publish/release-publish.impl.ts index 4f8e55095918b..a15f813b9a715 100644 --- a/packages/js/src/executors/release-publish/release-publish.impl.ts +++ b/packages/js/src/executors/release-publish/release-publish.impl.ts @@ -286,10 +286,10 @@ export default async function runExecutor( const stdoutData = JSON.parse(err.stdout?.toString() || '{}'); console.error('npm publish error:'); - if (stdoutData.error.summary) { + if (stdoutData.error?.summary) { console.error(stdoutData.error.summary); } - if (stdoutData.error.detail) { + if (stdoutData.error?.detail) { console.error(stdoutData.error.detail); } @@ -297,6 +297,11 @@ export default async function runExecutor( console.error('npm publish stdout:'); console.error(JSON.stringify(stdoutData, null, 2)); } + + if (!stdoutData.error) { + throw err; + } + return { success: false, };