Full stack should be logged in CLI onError
JoshuaKGoldberg opened this issue ยท 2 comments
Describe the bug
When there is an error thrown running the CLI, all we get right now is the error message. No stack to indicate where it's being thrown.
To Reproduce
Steps to reproduce the behavior:
- Do something to cause an error to be thrown, such as ???
yarn all-contributors generate
Expected behavior
$ yarn all-contributors generate
/home/user/repos/repo/node_modules/.bin/all-contributors generate
Error: Cannot read property 'replace' of undefined
at /home/josh/repos/typescript-eslint/node_modules/all-contributors-cli/dist/file.js:123:45
at /home/josh/repos/typescript-eslint/node_modules/all-contributors-cli/dist/file.js:67:89
at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.
Actual behavior
$ yarn all-contributors generate
/home/user/repos/repo/node_modules/.bin/all-contributors generate
Cannot read property 'replace' of undefined
error Command failed with exit code 1.
Additional context
I don't know what is causing the errors in typescript-eslint/typescript-eslint#4653 (https://github.com/typescript-eslint/typescript-eslint/runs/5367805091?check_suite_focus=true) and would sure like a call stack to help to debug them. They only happen CI.
A single-line fix for this issue works in all-contributors
:
function onError(error) {
if (error) {
- console.error(error.message);
+ console.error(error.stack || error.message || error);
I'd be happy to send a PR! ๐
@JoshuaKGoldberg sure you're welcome to send a PR for this one.
๐ This issue has been resolved in version 6.20.5 ๐
The release is available on:
Your semantic-release bot ๐ฆ๐