diff --git a/templates/boilerplate/config/communication.js b/templates/boilerplate/config/communication.js index 9a7ee8db..641c0cd4 100644 --- a/templates/boilerplate/config/communication.js +++ b/templates/boilerplate/config/communication.js @@ -14,7 +14,7 @@ module.exports = { port: 8546, // Port of the blockchain node type: "ws" // Type of connection (ws or rpc) } - } + }, // merges with the settings in default // used with "embark run privatenet" diff --git a/templates/boilerplate/config/namesystem.js b/templates/boilerplate/config/namesystem.js index 09a6e3f7..35ef7e9a 100644 --- a/templates/boilerplate/config/namesystem.js +++ b/templates/boilerplate/config/namesystem.js @@ -14,7 +14,7 @@ module.exports = { 'status': '0x1a2f3b98e434c02363f3dac3174af93c1d690914' } } - } + }, // merges with the settings in default // used with "embark run privatenet" diff --git a/templates/demo/app/dapp.js b/templates/demo/app/dapp.js index 77a837fb..2117558b 100644 --- a/templates/demo/app/dapp.js +++ b/templates/demo/app/dapp.js @@ -18,6 +18,7 @@ class App extends React.Component { this.handleSelect = this.handleSelect.bind(this); this.state = { + error: null, activeKey: 1, whisperEnabled: false, storageEnabled: false, @@ -26,7 +27,12 @@ class App extends React.Component { } componentDidMount() { - EmbarkJS.onReady(() => { + EmbarkJS.onReady((err) => { + if (err) { + // If err is not null then it means something went wrong connecting to ethereum + // you can use this to ask the user to enable metamask for e.g + return this.setState({error: err}); + } if (EmbarkJS.isNewWeb3()) { EmbarkJS.Messages.Providers.whisper.getWhisperVersion((err, _version) => { if (err) { @@ -70,7 +76,14 @@ class App extends React.Component { } render() { - return (

Embark - Usage Example

+ if (this.state.error) { + return (
+
Something went wrong connecting to ethereum. Please make sure you have a node running or are using metamask to connect to the ethereum network:
+
{this.state.error}
+
); + } + return (
+

Embark - Usage Example

diff --git a/templates/demo/config/communication.js b/templates/demo/config/communication.js index b776b339..e8998cf2 100644 --- a/templates/demo/config/communication.js +++ b/templates/demo/config/communication.js @@ -14,7 +14,7 @@ module.exports = { port: 8546, // Port of the blockchain node type: "ws" // Type of connection (ws or rpc) } - } + }, // merges with the settings in default // used with "embark run privatenet" diff --git a/templates/demo/config/namesystem.js b/templates/demo/config/namesystem.js index 09a6e3f7..35ef7e9a 100644 --- a/templates/demo/config/namesystem.js +++ b/templates/demo/config/namesystem.js @@ -14,7 +14,7 @@ module.exports = { 'status': '0x1a2f3b98e434c02363f3dac3174af93c1d690914' } } - } + }, // merges with the settings in default // used with "embark run privatenet"