Skip to content
This repository has been archived by the owner on Jun 14, 2018. It is now read-only.

Test provider connection and fail early #4

Closed
wants to merge 2 commits into from
Closed

Conversation

gnidan
Copy link
Contributor

@gnidan gnidan commented Jul 14, 2017

Ref: trufflesuite/truffle#421

Example output after change:

/Users/gnidan/tmp/truffle/truffle-config/index.js:157
          throw error;
          ^

Error: Could not connect to your RPC client. Please check your RPC configuration.
    at /Users/gnidan/tmp/truffle/truffle-provider/index.js:53:17
    at /Users/gnidan/tmp/truffle/truffle-provider/node_modules/web3/lib/web3/property.js:119:13
    at /Users/gnidan/tmp/truffle/truffle-provider/node_modules/web3/lib/web3/requestmanager.js:82:20
    at XMLHttpRequest.request.onreadystatechange (/Users/gnidan/tmp/truffle/truffle-provider/node_modules/web3/lib/web3/httpprovider.js:118:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/Users/gnidan/tmp/truffle/truffle-provider/node_modules/xhr2/lib/xhr2.js:64:18)
    at XMLHttpRequest._setReadyState (/Users/gnidan/tmp/truffle/truffle-provider/node_modules/xhr2/lib/xhr2.js:354:12)
    at XMLHttpRequest._onHttpRequestError (/Users/gnidan/tmp/truffle/truffle-provider/node_modules/xhr2/lib/xhr2.js:544:12)
    at ClientRequest.<anonymous> (/Users/gnidan/tmp/truffle/truffle-provider/node_modules/xhr2/lib/xhr2.js:414:24)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)

@gnidan gnidan changed the base branch from master to scratch July 14, 2017 15:14
@tcoulter
Copy link
Contributor

I want to add some late (but minor) requirements for this:

  • Error message should include possible failure cases. Feel free to use an error message that has multiple lines and formatting, i.e.,

    Could not connect to your Ethereum client. Please check that your Ethereum client:
    
    - is running
    - is accepting RPC connections (i.e., "--rpc" option is used in geth)
    - is accessible over the network
    

    And perhaps we can have the error message link to a FAQ or document that describes this (ignore this requirement if you can't find a useful document)

  • The error itself should be wrapped in truffle-error. Note that Truffle uses truffle-error as a "flag" to print out error messages nicely instead of showing a full stack trace.

@gnidan
Copy link
Contributor Author

gnidan commented Jul 14, 2017

Closing this in favor of overriding low-level send/sendAsync inside truffle-provider

@gnidan gnidan closed this Jul 14, 2017
@gnidan gnidan deleted the provider-errors branch July 14, 2017 16:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants