Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Refactoring Commands to exit with non-0 status codes on failure. #207
Signed-off-by: Tommy Stigen Olsen firstname.lastname@example.org
As discussed in #183, I have gone through the commands and made all of the cobra commands
Refactors all cobra commands except version (which never generates errors). This lets all of the commands exit with status-code 1 if an error occurs.
Since RunE will print any error it receives, i've suppressed them so the software doesnt repeat itself.
Motivation and Context
How Has This Been Tested?
Tested through compiling and running a few functions that failed.
Types of changes
I've pushed some new code. I've started going through the commands one more time to capture the output and found a bug that slipped me last time. If a user would try to deploy with a malformed label not including a =, you would get a index out of range panic. Added a catch for that.
I'll be a little more thorough and retest everything to make sure everything is as its supposed to. Will post the results when I'm done.
Built one function with no parameters
Built one function with lang parameter, but without handler or image
built one with lang and handler parameters, not image
I assume these two last ones should have failed with proper error messages,
Here is tested on a file with some giberish in it.
Other functions that parse yaml(like
With both update and replace
All label related error messages.
No name supplied
Gateway is unreachable, triggering error from proxy.GetFunctions
Trying to logout without any valid logins registered(No config file exists)
Trying to create a function that already exists
Changed samples to not have valid image keys.
Currently the go routines does not return anything
Doesn't give any errors
referenced this pull request
Nov 7, 2017
Compiled this PR and did some cursory checks, looks good so far. The only suggestion I have is that we could use some tests for this particular functionality (test error code result when a command fails, make sure it's
As far as I have gathered, the only thing that seems left up for discussion is the
Personally, I think the current style of error messages are just fine, since we are exiting the program anyways, prepending "Error" to the last error message or obvious instruction doesn't really do anything.