cyclonedx-node-yarn icon indicating copy to clipboard operation
cyclonedx-node-yarn copied to clipboard

Change exit code to `1` whenever an error was logged.

Open AugustusKling opened this issue 1 year ago • 1 comments

This is a preparation for CycloneDX/cyclonedx-javascript-library#1255

Adds a wrapper around the native console API to track if any errors were logged. If this is the case a non-zero exit code is set (via Clipanion as it sets exit codes after plugin commands are complete in https://github.com/arcanis/clipanion/blob/master/sources/advanced/Cli.ts#L551).

This PR does not include adding additional logs to address CycloneDX/cyclonedx-javascript-library#1255

AugustusKling avatar Jan 17 '25 21:01 AugustusKling

Why so complicated? Why not simply throw on error?

What is even the use case? Continuing after a warning - sure, but why should the code continue after an error was detected? I'd rather throw an Error - it probably is not even needed to catch it, as yarn's plugin handler would handle it, right?

jkowalleck avatar Jan 18 '25 04:01 jkowalleck