From 1a03a83d00234395ed12b5c4d36b7c5fc4f9c7ea Mon Sep 17 00:00:00 2001 From: French Ben Date: Tue, 12 Apr 2016 17:41:05 -0700 Subject: [PATCH] Improved errors and native logic Signed-off-by: French Ben --- src/components/ContainerHome.react.js | 12 +++++++++++- src/utils/DockerUtil.js | 1 + src/utils/SetupUtil.js | 2 +- src/utils/Util.js | 12 ++++++------ 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/components/ContainerHome.react.js b/src/components/ContainerHome.react.js index 0399c0da93..4da81d2d96 100644 --- a/src/components/ContainerHome.react.js +++ b/src/components/ContainerHome.react.js @@ -51,10 +51,20 @@ var ContainerHome = React.createClass({ let body; if (this.props.container.Error) { + let error = this.props.container.Error.message; + console.log('Err: %o - %o', typeof error, error); + if (error.indexOf('ETIMEDOUT') !== -1) { + error = 'Timeout error - Try and restart your VM by running: \n"docker-machine restart default" in a terminal'; + } + if (error.indexOf('ECONNREFUSED') !== -1) { + error = 'Is your VM up and running? Check that "docker ps" works in a terminal.'; + } body = (

We're sorry. There seems to be an error:

-

{this.props.container.Error}

+ {error.split('\n').map(i => { + return

{i}

; + })}

If this error is invalid, please file a ticket on our Github repo.

File Ticket
diff --git a/src/utils/DockerUtil.js b/src/utils/DockerUtil.js index 1942791936..ffc01c2505 100644 --- a/src/utils/DockerUtil.js +++ b/src/utils/DockerUtil.js @@ -400,6 +400,7 @@ export default { if (err) { // socket hang up can be captured console.error(err); + containerServerActions.error({name: this.activeContainerName, err}); return; } diff --git a/src/utils/SetupUtil.js b/src/utils/SetupUtil.js index ed624589ea..b6932a8f70 100644 --- a/src/utils/SetupUtil.js +++ b/src/utils/SetupUtil.js @@ -18,7 +18,6 @@ const precreateCheckExitCode = 3; let _retryPromise = null; let _timers = []; -let useNative = util.isNative() ? util.isNative() : true; export default { simulateProgress (estimateSeconds) { @@ -40,6 +39,7 @@ export default { async useVbox () { metrics.track('Retried Setup with VBox'); router.get().transitionTo('loading'); + util.native = false; setupServerActions.error({ error: { message: null }}); _retryPromise.resolve(); }, diff --git a/src/utils/Util.js b/src/utils/Util.js index 6e15f07a44..7c13bb8b84 100644 --- a/src/utils/Util.js +++ b/src/utils/Util.js @@ -9,6 +9,7 @@ const dialog = remote.dialog; const app = remote.app; module.exports = { + native: null, execFile: function (args, options) { return new Promise((resolve, reject) => { child_process.execFile(args[0], args.slice(1), options, (error, stdout) => { @@ -38,21 +39,20 @@ module.exports = { return process.platform === 'linux'; }, isNative: function () { - let native = null; - if (native === null) { + if (this.native === null) { try { // Check if file exists fs.statSync('/var/run/docker.sock'); - native = true; + this.native = true; } catch (e) { if (this.isLinux()) { - native = true; + this.native = true; } else { - native = false; + this.native = false; } } } - return native; + return this.native; }, binsPath: function () { return this.isWindows() ? path.join(this.home(), 'Kitematic-bins') : path.join('/usr/local/bin');