Skip to content
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

Jenkins.Init() should return the status code #289

Open
NeonWizard opened this issue Sep 15, 2022 · 0 comments
Open

Jenkins.Init() should return the status code #289

NeonWizard opened this issue Sep 15, 2022 · 0 comments

Comments

@NeonWizard
Copy link

NeonWizard commented Sep 15, 2022

I'm having difficulty connecting to an enterprise Jenkins instance, and can't troubleshoot whether my credentials are invalid or unauthorized, since Jenkins.Init() doesn't tell me the status code, just that it failed.

Suggested change:

j.Version = rsp.Header.Get("X-Jenkins")
if j.Raw == nil || rsp.StatusCode != http.StatusOK {
    return nil, errors.New(fmt.Sprintf("Connection Failed, please verify that the host and credentials are correct. Status Code %d", rsp.StatusCode))
}

Previously suggested by @vperson in #210 (comment)

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

No branches or pull requests

1 participant