saf
saf copied to clipboard
Update Error Handling
When using the syntax throw new Error("Error message)
in different cases such as this file used in the validate threshold command, the output if the error is thrown is not a clean error with proper exit code. The errors appear in pipelines or other uses like this:
The desired output is to have the pipeline fail, but show a clean exit and error code to make it more clear to the user that it is not an error with the code itself.
This may include defining exit codes within the CLI, like so:
exit 0 - exception met for function, correctly ran function with valid flags and input
exit 1 - exception not met for function, correctly ran function with valid flags and input
exit 2 - invalid flags or input to the cli
exit 127 - internal error
...
...
For reference: Github Actions Exit Code Oclif Error Handling