-
Notifications
You must be signed in to change notification settings - Fork 33
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
Set and document exit codes #215
Comments
Instead of catching the exceptions individually per command a
In most of the cases the thrown exceptions should be an instance of https://github.com/adobe/aio-lib-core-errors#aiocoresdkerror |
See my comment in #224 -- I think there's a generalized issue here related to non-interactive use. |
Actually calling |
Is there any progress in exit code handling? On Friday and today we have seen in our Github workflows that the aio cloudmanager commands do not work because the key expired, but this was returned as success to the pipeline: $ aio cloudmanager:pipeline:update <id> --tag="v2.3.4"
updating pipeline... 400 - {"error_description":"Could not match JWT signature to any of the bindings","error":"invalid_token"}
$ echo $?
0
$ aio cloudmanager:pipeline:create-execution <id>
starting execution... 400 - {"error_description":"No valid bindings were found for organization and technical account combination","error":"invalid_token"}
$ echo $?
0 The Adobe IO CLI tools used in the Github workflow:
|
hmm. I guess I misunderstood @kwin's last comment. I thought that the exit code would be 1 (although strangely in my testing it seems to be 2, not 1). But it appears that this is inconsistent because So I fear that what @kwin originally suggested is necessary -- extract the catch blocks from all of the commands and do it centrally. |
Looking at the options available, I think it is achievable to set four distinct exit codes: 1 - A generic error has occurred While I understand the desire to have a unique exit code per error, I don't think that's practical, both due to internal API limitations and because it is not unimaginable that the Cloud Manager SDK could soon emit more than 255 unique error codes. |
🎉 This issue has been resolved in version 2.5.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
To ease usage of the cli in non-interactive environments it would be good to set and document the process exit codes in case of failures for each command.
Currently always the default exit code (0 = SUCCESS) is used.
For that https://oclif.io/docs/commands#thiserrormessage-string--error-options-code-string-exit-number-ref-string-suggestions-string has to be used (e.g. in
aio-cli-plugin-cloudmanager/src/commands/cloudmanager/execution/get-step-details.js
Line 30 in 02527eb
A mapping of the codes in https://github.com/adobe/aio-lib-cloudmanager/blob/1ec31d3234b97e09840864ed6eadaf7231e89914/src/SDKErrors.js#L51 and an exit code should be established.
The text was updated successfully, but these errors were encountered: