Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error handling #837

Open
TarSzator opened this issue Sep 5, 2024 · 7 comments
Open

Error handling #837

TarSzator opened this issue Sep 5, 2024 · 7 comments

Comments

@TarSzator
Copy link

Not sure if this is the right spot for my request.

Starting from the following issue:
We use our own error classes. These have an ID which is a number and a code which is an enumeration.
When these errors are thrown the error message is written but we also get this error:

TypeError [ERR_INVALID_ARG_TYPE]: The "code" argument must be of type number. Received type string ('InternalError')
    at process.set [as exitCode] (node:internal/bootstrap/node:123:9)
    at process.exit (node:internal/process/per_thread:180:24)
    at onError (/opt/homebrew/lib/node_modules/yo/lib/cli.js:117:11)
    at /opt/homebrew/lib/node_modules/yo/lib/cli.js:168:54
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async init (/opt/homebrew/lib/node_modules/yo/lib/cli.js:168:5)
    at async pre (/opt/homebrew/lib/node_modules/yo/lib/cli.js:83:3)
    at async /opt/homebrew/lib/node_modules/yo/lib/cli.js:193:3

Goal:
I would like to influence the error handling from yeoman. So I would like to provide a function to yeoman that is triggered with the error and what ever I return is printed to the console.

Advantage:
With this I could prevent the check if code is a number.
And I could also improve the output to be more then just the message property of my error

Question:
Does already exist a way to do this? I did not find it in the documentation.

Note:
I am aware of the error event but this does not help me with the code error issue.

Copy link

github-actions bot commented Oct 6, 2024

This issue is stale because it has been open with no activity. Remove stale label or comment or this will be closed

@mshima
Copy link
Member

mshima commented Oct 6, 2024

This looks an yo issue.
Looks like yo is forward the error code to process.exit().

Copy link

github-actions bot commented Nov 7, 2024

This issue is stale because it has been open with no activity. Remove stale label or comment or this will be closed

@TarSzator
Copy link
Author

TarSzator commented Nov 7, 2024

Is there some action planed by the maintainers?
Would also like to get the stale tag removed 😃

Copy link

github-actions bot commented Dec 8, 2024

This issue is stale because it has been open with no activity. Remove stale label or comment or this will be closed

@mshima
Copy link
Member

mshima commented Dec 8, 2024

I will probably move to yo repository, we may have some news about yo maintenance soon.

Copy link

github-actions bot commented Jan 9, 2025

This issue is stale because it has been open with no activity. Remove stale label or comment or this will be closed

@mshima mshima transferred this issue from yeoman/generator Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants