fix(runcommand): output correct invalid creds error#410
Conversation
|
Thank you for the pull request! I would prefer the fix to be other way around, i.e. show the same error message that commands that use resolver (e.g. |
|
Appreciate the response and suggested fix. Let me work on the PR and get back with the changes. In the meantime, if someone else wants to work on it, just let me know so we don't do double work. |
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
|
Seems like there are multiple paths to fixing this issue. Option 1.By adding a resolver to every service (I added just for an account), the resolver can be called and exit with the correct error code. Option 2Most straightaway solution. Can I get your input on this @kangasta ? |
|
Thank you for further looking into this! 🙌 I think second option would be better as it is more simple. For the tests there could be a helper function that both initializes the mock service and sets up mocking for the Adding resolver to list commands would also feel a bit off since these commands do not take arguments so there are no arguments to resolve 🤔 |
|
updated PR to call GetAccount if the resolve mode is none ➜ upctl git:(fix/execute-error) ✗ ./upctl account show
Error: invalid user credentials, authentication failed using the given username and password
➜ upctl git:(fix/execute-error) ✗ echo $?
103
➜ upctl git:(fix/execute-error) ✗ ./upctl server list
Error: invalid user credentials, authentication failed using the given username and password
➜ upctl git:(fix/execute-error) ✗ echo $?
103
➜ upctl git:(fix/execute-error) ✗ ./upctl version
Version: dev-9d0ec785-dirty
Build date: unknown
Built with: go1.24.3
System: linux
Architecture: amd64 |
68400ca to
93f4abf
Compare
closes #392
The issue:
Invalid creds returns error at runcommand.go only if resolver is used.
If the resolver is not used (ex., server list), it will go into the worker queue and render an error with error output.
This is why some commands return expected output and some just an error message.
The fix:
output the error and stop progress log to print error message as other commands do without the resolver.