Skip to content

Commit

Permalink
add explicit error msg if repo dir does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
nonsense authored and jennijuju committed Aug 1, 2021
1 parent 7d70ef7 commit 783fa6b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cli/util/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cliutil

import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
Expand Down Expand Up @@ -142,6 +143,15 @@ func GetAPIInfo(ctx *cli.Context, t repo.RepoType) (APIInfo, error) {
return APIInfo{}, xerrors.Errorf("could not open repo at path: %s; %w", p, err)
}

exists, err := r.Exists()
if err != nil {
return APIInfo{}, xerrors.Errorf("repo.Exists returned an error: %w", err)
}

if !exists {
return APIInfo{}, errors.New("repo directory does not exist. Make sure your configuration is correct")
}

ma, err := r.APIEndpoint()
if err != nil {
return APIInfo{}, xerrors.Errorf("could not get api endpoint: %w", err)
Expand Down

0 comments on commit 783fa6b

Please sign in to comment.