Skip to content

Commit

Permalink
Merge pull request #6965 from filecoin-project/jen/backport
Browse files Browse the repository at this point in the history
Backport master -> v1.11.1
  • Loading branch information
jennijuju authored Aug 1, 2021
2 parents 7d70ef7 + 783fa6b commit 5939623
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 5939623

Please sign in to comment.