all-contributors / cli

Tool to help automate adding contributor acknowledgements according to the all-contributors specification ✨
https://allcontributors.org
Other
414 stars 145 forks source link

Full stack should be logged in CLI onError #312

Closed JoshuaKGoldberg closed 2 years ago

JoshuaKGoldberg commented 2 years ago

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:

  1. Do something to cause an error to be thrown, such as ???
  2. 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 https://github.com/typescript-eslint/typescript-eslint/issues/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! 💖

tenshiAMD commented 2 years ago

@JoshuaKGoldberg sure you're welcome to send a PR for this one.

all-contributors-release-bot commented 1 year ago

:tada: This issue has been resolved in version 6.20.5 :tada:

The release is available on:

Your semantic-release bot :package::rocket: