Skip to content

git-ext: Better handling of "not found" errors #29

@cloudhead

Description

@cloudhead

Currently I have code like this:

        match repo.reference(remote, sigref) {
            Err(git_ext::Error::Git(e)) if git_ext::is_not_found_err(&e) => None,
            Err(git_ext::Error::NotFound(_)) => None,
            Err(e) => return Err(e.into()),
...
        };

It would be nice if git_ext::Error simply had a is_not_found(&self) -> bool method, so that it could be converted to:

        match repo.reference(remote, sigref) {
            Err(e) if e.is_not_found() => None,
            Err(e) => return Err(e.into()),
...
        };

This is the pattern I've been using with my other error types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions