Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

If project create fails because of auth error, indicate that with a specific error key #3100

Open
eharris369 opened this issue Jun 4, 2020 · 7 comments

Comments

@eharris369
Copy link

Further requirement for #2647

If project create fails because the authorization for the template source failed, indicate this on the result with a specific error key so the IDEs know to prompt the user to update the authorization information.

@jcockbain
Copy link
Contributor

/assign

@rwalle61
Copy link
Contributor

rwalle61 commented Jun 9, 2020

FYI basically cwctl project create currently returns 401 Unauthorised when it tries to clone a GHE repo using incorrect credentials. (If you don't supply credentials at all, you should get 404).

The IDEs could treat 401 errors to mean "the credentials are incorrect", but Erin and I decided it'd be preferable for cwctl to provide a specific error code (such as one of these) indicating when the credentials are incorrect, so the IDEs don't have responsibility for understanding GitHub API errors

So for implementation, it may be as straightforward as making sure that when in cwctl we get a 401 from the GHE client, the output of cwctl project create contains a (new) error code indicating INVALID_GIT_CREDENTIALS

@jcockbain
Copy link
Contributor

/pipeline In Progress

@jcockbain
Copy link
Contributor

jcockbain commented Jun 10, 2020

Thanks @rwalle61. By change the error key, do you mean changing project create in the below output to something specific to unauthorized credentials?

cwctl 
	--json project create 
	-u https://github.ibm.com/James-Cockbain/git-basics 
	-p ~/documents/workspace/james100a2 
	--personalAccessToken not-token

{"error":"project create","error_description":"unexpected status code: 401 Unauthorized"}
exit status 1

@rwalle61
Copy link
Contributor

I don't know exactly how cwctl currently provides the IDEs with other specific errors, but yes if that's how cwctl does it for other errors

@jcockbain
Copy link
Contributor

It seems in other commands the error is output as an error code format e.g. {"error": "conn_not_found"}, so I think that's the clearest way. Will make that change.

@jcockbain
Copy link
Contributor

/pipeline review/qa

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants