diff --git a/cmd/geth/consolecmd.go b/cmd/geth/consolecmd.go index 2500a969cf5e..d20f1c7dd5fc 100644 --- a/cmd/geth/consolecmd.go +++ b/cmd/geth/consolecmd.go @@ -95,7 +95,7 @@ func localConsole(ctx *cli.Context) error { console, err := console.New(config) if err != nil { - utils.Fatalf("Failed to start the JavaScript console: %v", err) + utils.Fatalf("Failed to start the local JavaScript console: %v", err) } defer console.Stop(false) @@ -143,7 +143,7 @@ func remoteConsole(ctx *cli.Context) error { console, err := console.New(config) if err != nil { - utils.Fatalf("Failed to start the JavaScript console: %v", err) + utils.Fatalf("Failed to start the remote JavaScript console: %v", err) } defer console.Stop(false) @@ -196,7 +196,7 @@ func ephemeralConsole(ctx *cli.Context) error { console, err := console.New(config) if err != nil { - utils.Fatalf("Failed to start the JavaScript console: %v", err) + utils.Fatalf("Failed to start the ephemeral JavaScript console: %v", err) } defer console.Stop(false) diff --git a/console/console.go b/console/console.go index b280d4e65d4c..0284bbd09026 100644 --- a/console/console.go +++ b/console/console.go @@ -133,7 +133,7 @@ func (c *Console) init(preload []string) error { // Load the supported APIs into the JavaScript runtime environment apis, err := c.client.SupportedModules() if err != nil { - return fmt.Errorf("api modules: %v", err) + return fmt.Errorf("cannot create api client modules: %v", err) } flatten := "var eth = web3.eth; var personal = web3.personal; " for api := range apis { diff --git a/rpc/http.go b/rpc/http.go index e8f51150f4a7..bb85de60a8a5 100644 --- a/rpc/http.go +++ b/rpc/http.go @@ -27,10 +27,12 @@ import ( "mime" "net" "net/http" + "runtime/debug" "strings" "sync" "time" + "github.com/ethereum/go-ethereum/log" "github.com/rs/cors" ) @@ -70,6 +72,7 @@ func (hc *httpConn) Close() error { // using the provided HTTP Client. func DialHTTPWithClient(endpoint string, client *http.Client) (*Client, error) { req, err := http.NewRequest(http.MethodPost, endpoint, nil) + log.Debug(fmt.Sprintf("connecting to HTTP endpoint %s", endpoint)) if err != nil { return nil, err } @@ -96,6 +99,8 @@ func (c *Client) sendHTTP(ctx context.Context, op *requestOp, msg interface{}) e defer respBody.Close() var respmsg jsonrpcMessage if err := json.NewDecoder(respBody).Decode(&respmsg); err != nil { + err := fmt.Errorf("Error creating HTTP connection to RPC socket. Did you set --rpcvhosts on the server? Actual error is \"%s\"", err) + debug.PrintStack() return err } op.resp <- &respmsg