Skip to content

Commit

Permalink
fix(tag/snap): show the error message when "npm pack" fails (#7366)
Browse files Browse the repository at this point in the history
Currently, in case of failure it shows:
```
failed running npm pack at /Users/davidfirst/Library/Caches/Bit/capsules/c8faea78513ab52bfd30032f9fa81289c5628e6c/[email protected]
undefined
```
This PR fixes it to show the original error-message and log the error
instance.
  • Loading branch information
davidfirst authored May 5, 2023
1 parent a041cdd commit 3a06481
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pack/packer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ export class Packer {
return { metadata, warnings, errors, startTime, endTime: Date.now() };
} catch (err: any) {
const errorMsg = `failed running ${packageManager} ${args} at ${cwd}`;
logger.error(`${errorMsg}`);
logger.error(`${errorMsg}`, err);
if (err.stderr) logger.error(`${err.stderr}`);
errors.push(`${errorMsg}\n${err.stderr}`);
errors.push(`${errorMsg}\n${err.stderr || err.message}`);
return { errors, startTime, endTime: Date.now() };
}
}
Expand Down

0 comments on commit 3a06481

Please sign in to comment.