Merge pull request #6965 from filecoin-project/jen/backport

Backport master -> v1.11.1
This commit is contained in:
Jiaying Wang 2021-08-01 03:24:38 -04:00 committed by GitHub
commit 5939623f26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@ package cliutil
import ( import (
"context" "context"
"errors"
"fmt" "fmt"
"net/http" "net/http"
"net/url" "net/url"
@ -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) 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() ma, err := r.APIEndpoint()
if err != nil { if err != nil {
return APIInfo{}, xerrors.Errorf("could not get api endpoint: %w", err) return APIInfo{}, xerrors.Errorf("could not get api endpoint: %w", err)