This commit is contained in:
Lee Azzarello 2018-04-16 19:28:49 +00:00 committed by GitHub
commit fb9b992500
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View file

@ -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)

View file

@ -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 {

View file

@ -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