fix(prepare-package): always return an error message

ref #4128
This commit is contained in:
Zoltan Kochan
2021-12-14 22:14:15 +02:00
parent a087f339e3
commit eec4b195d8
2 changed files with 6 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"@pnpm/prepare-package": patch
---
Always return an error message when the preparation of a package fails.

View File

@@ -12,7 +12,7 @@ export default async function preparePackage (pkgDir: string) {
try {
await execa(pm, ['install'], { cwd: pkgDir })
} catch (err: any) { // eslint-disable-line
throw new PnpmError('PREPARE_PKG_FAILURE', `${err.shortMessage}`) // eslint-disable-line
throw new PnpmError('PREPARE_PKG_FAILURE', err.shortMessage ?? err.message)
}
await rimraf(path.join(pkgDir, 'node_modules'))
}