diff --git a/rpc/rpc.go b/rpc/rpc.go index e39bcea..aaa81de 100644 --- a/rpc/rpc.go +++ b/rpc/rpc.go @@ -2,6 +2,7 @@ package rpc import ( + "errors" "net" "net/http" "net/rpc" @@ -12,6 +13,11 @@ import ( "github.com/multiverse-vcs/go-multiverse/peer" ) +// ErrConnect is the human friendly error message for failed connections. +var ErrConnect = errors.New(`Could not connect to local RPC server. +Make sure the Multiverse daemon is up. +See 'multi help daemon' for more info.`) + // Service implements an RPC service. type Service struct { client *peer.Client @@ -35,7 +41,12 @@ func NewClient() (*rpc.Client, error) { return nil, err } - return rpc.DialHTTP("unix", sock) + client, err := rpc.DialHTTP("unix", sock) + if err != nil { + return nil, ErrConnect + } + + return client, nil } // ListenAndServer starts an RPC listener.