mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
Merge b4a5f49cbc into ec3db0f56c
This commit is contained in:
commit
fb9b992500
3 changed files with 9 additions and 4 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue