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

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
  • Loading branch information
Stebalien committed Mar 29, 2019
1 parent 524e5d8 commit 897d1b1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion 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 897d1b1

Please sign in to comment.