cdxgen icon indicating copy to clipboard operation
cdxgen copied to clipboard

fail-on-error set but exit code is still 0 (== SUCCESS)

Open winren9 opened this issue 9 months ago • 1 comments

When I accidently set the wrong --project-id parameter and want to upload via cdxgen --server-url $url --project-id wrongid --api-key $apiToken --fail-on-error .

then i get (enabling debug output) that the submit goes wrong: Unable to submit the SBOM to the Dependency-Track server using POST method HTTPError: Response code 400 (Bad Request)

When i fetch the exit code via $? it is still 0, but in my opinion it should be != 0.

Should the Parameter --fail-on-error work here too?

winren9 avatar Mar 18 '25 10:03 winren9

The return value from submitBom is not checked here. Could you send a PR to do process.exit(1) based on the response?

prabhu avatar Mar 18 '25 13:03 prabhu