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

fix: warning UnhandledPromiseRejectionWarning not throwing with node < 15 #112

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MathieuPuech
Copy link
Contributor

When you use rocket lint with a version prior to node 15, when you have links errors it does not throw an error but emit a warning:

(Use `node --trace-warnings ...` to show where the warning was created)
(node:49856) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:49856) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The exit code of the command is 0 and is not considered as an error.

Node has changed this behavior from the version 15.0.0:

v15.0.0 Changed default mode to throw. Previously, a warning was emitted.

See https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode

I didn't changed the behavior your have on node 15 but it could be good to catch these errors and do a process exit instead.

@changeset-bot
Copy link

changeset-bot bot commented Apr 22, 2021

🦋 Changeset detected

Latest commit: 86ac08b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@rocket/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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

Successfully merging this pull request may close these issues.

1 participant