Skip to content

Commit

Permalink
return an error when the API file isn't found
Browse files Browse the repository at this point in the history
fixes #7


This commit was moved from ipfs/go-ipfs-http-client@897d1b1
  • Loading branch information
Stebalien committed Mar 29, 2019
1 parent e76ecd3 commit c6f704b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/httpapi/api.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package httpapi

import (
"errors"
"fmt"
"io/ioutil"
gohttp "net/http"
Expand All @@ -22,6 +23,9 @@ const (
EnvDir = "IPFS_PATH"
)

// ErrApiNotFound if we fail to find a running daemon.
var ErrApiNotFound = errors.New("ipfs api address could not be found")

// HttpApi implements github.com/ipfs/interface-go-ipfs-core/CoreAPI using
// IPFS HTTP API.
//
Expand Down Expand Up @@ -54,7 +58,7 @@ func NewPathApi(ipfspath string) (*HttpApi, error) {
a, err := ApiAddr(ipfspath)
if err != nil {
if os.IsNotExist(err) {
err = nil
err = ErrApiNotFound
}
return nil, err
}
Expand Down

0 comments on commit c6f704b

Please sign in to comment.