Skip to content
This repository was archived by the owner on Oct 5, 2023. It is now read-only.

Commit 897d1b1

Browse files
committed
return an error when the API file isn't found
fixes #7
1 parent 524e5d8 commit 897d1b1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

api.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package httpapi
22

33
import (
4+
"errors"
45
"fmt"
56
"io/ioutil"
67
gohttp "net/http"
@@ -22,6 +23,9 @@ const (
2223
EnvDir = "IPFS_PATH"
2324
)
2425

26+
// ErrApiNotFound if we fail to find a running daemon.
27+
var ErrApiNotFound = errors.New("ipfs api address could not be found")
28+
2529
// HttpApi implements github.com/ipfs/interface-go-ipfs-core/CoreAPI using
2630
// IPFS HTTP API.
2731
//
@@ -54,7 +58,7 @@ func NewPathApi(ipfspath string) (*HttpApi, error) {
5458
a, err := ApiAddr(ipfspath)
5559
if err != nil {
5660
if os.IsNotExist(err) {
57-
err = nil
61+
err = ErrApiNotFound
5862
}
5963
return nil, err
6064
}

0 commit comments

Comments
 (0)