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

Enrich early EOF error message #410

Merged
merged 3 commits into from
Jul 26, 2022
Merged

Enrich early EOF error message #410

merged 3 commits into from
Jul 26, 2022

Conversation

pjbgf
Copy link
Member

@pjbgf pjbgf commented Jul 20, 2022

Some Git servers may close the connection abruptly when the user does not have write access to a repository whilst trying to do a push operation. The result for the end users is an early EOF message, which is not very helpful.

This PR changes the error message to: early EOF (the SSH key may not have write access to the repository).

Fixes #405.

The new make target creates an env file that can be
used for debugging purposes.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
@pjbgf pjbgf added the area/git Git related issues and pull requests label Jul 20, 2022
@pjbgf pjbgf force-pushed the early-eof branch 2 times, most recently from 3197086 to 7cc4085 Compare July 25, 2022 17:33
@pjbgf pjbgf marked this pull request as ready for review July 25, 2022 17:33
@pjbgf pjbgf requested a review from aryan9600 July 26, 2022 08:27

err = push(context.TODO(), repo.Workdir(), "test", access)
g.Expect(err).To(HaveOccurred())
g.Expect(err.Error()).To(ContainSubstring("early EOF"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this test is supposed to test the enrichment of the "early EOF" error messages, it'd make more sense to check for the additional message that we explicitly add.

Comment on lines 890 to 892
if err.Error() == "early EOF" {
return fmt.Errorf("early EOF (the SSH key may not have write access to the repository)")
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this would be better?

Suggested change
if err.Error() == "early EOF" {
return fmt.Errorf("early EOF (the SSH key may not have write access to the repository)")
}
if strings.Contains(err.Error(), "early EOF") {
return fmt.Errorf("%w (the SSH key may not have write access to the repository)", err)
}

Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks @pjbgf

Paulo Gomes added 2 commits July 26, 2022 11:17
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
Copy link
Member

@aryan9600 aryan9600 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/git Git related issues and pull requests
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Reconciler error: early EOF
4 participants