Skip to content

Remote.Fetch: return a unique error type when ref not found #162

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

Merged
merged 1 commit into from
Oct 9, 2020

Conversation

yabberyabber
Copy link
Contributor

Small quality of life improvement - if Fetch can return a distinct error type
as opposed to fmt.Errorf("couldn't find remote ref") then it becomes very easy
for callers to determine what kind of failure occurred using the new-ish
errors.Is and errors.As api.

ref https://golang.org/pkg/errors/

It can be useful for callers to distinguish between an error of
"couldn't find remote ref" and some other error like "network error".

Creating an explicit error type for this allows consumers to
determine the kind of error using the errors.Is and errors.As
interface added in go1.13
@mcuadros mcuadros changed the title Fetch should return a unique error type when ref not found Remote.Fetch: return a unique error type when ref not found Oct 9, 2020
@mcuadros mcuadros merged commit 97741e7 into go-git:master Oct 9, 2020
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

Successfully merging this pull request may close these issues.

2 participants