mirror of https://github.com/docker/docs.git
Improved errors and native logic
Signed-off-by: French Ben <me+git@frenchben.com>
This commit is contained in:
parent
b8495ee800
commit
1a03a83d00
|
|
@ -51,10 +51,20 @@ var ContainerHome = React.createClass({
|
||||||
|
|
||||||
let body;
|
let body;
|
||||||
if (this.props.container.Error) {
|
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 = (
|
body = (
|
||||||
<div className="details-progress error">
|
<div className="details-progress error">
|
||||||
<h2>We're sorry. There seems to be an error:</h2>
|
<h2>We're sorry. There seems to be an error:</h2>
|
||||||
<p className="error-message">{this.props.container.Error}</p>
|
{error.split('\n').map(i => {
|
||||||
|
return <p className="error-message">{i}</p>;
|
||||||
|
})}
|
||||||
<p>If this error is invalid, please file a ticket on our Github repo.</p>
|
<p>If this error is invalid, please file a ticket on our Github repo.</p>
|
||||||
<a className="btn btn-action" onClick={this.handleErrorClick}>File Ticket</a>
|
<a className="btn btn-action" onClick={this.handleErrorClick}>File Ticket</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -400,6 +400,7 @@ export default {
|
||||||
if (err) {
|
if (err) {
|
||||||
// socket hang up can be captured
|
// socket hang up can be captured
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
containerServerActions.error({name: this.activeContainerName, err});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ const precreateCheckExitCode = 3;
|
||||||
|
|
||||||
let _retryPromise = null;
|
let _retryPromise = null;
|
||||||
let _timers = [];
|
let _timers = [];
|
||||||
let useNative = util.isNative() ? util.isNative() : true;
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
simulateProgress (estimateSeconds) {
|
simulateProgress (estimateSeconds) {
|
||||||
|
|
@ -40,6 +39,7 @@ export default {
|
||||||
async useVbox () {
|
async useVbox () {
|
||||||
metrics.track('Retried Setup with VBox');
|
metrics.track('Retried Setup with VBox');
|
||||||
router.get().transitionTo('loading');
|
router.get().transitionTo('loading');
|
||||||
|
util.native = false;
|
||||||
setupServerActions.error({ error: { message: null }});
|
setupServerActions.error({ error: { message: null }});
|
||||||
_retryPromise.resolve();
|
_retryPromise.resolve();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ const dialog = remote.dialog;
|
||||||
const app = remote.app;
|
const app = remote.app;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
native: null,
|
||||||
execFile: function (args, options) {
|
execFile: function (args, options) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
child_process.execFile(args[0], args.slice(1), options, (error, stdout) => {
|
child_process.execFile(args[0], args.slice(1), options, (error, stdout) => {
|
||||||
|
|
@ -38,21 +39,20 @@ module.exports = {
|
||||||
return process.platform === 'linux';
|
return process.platform === 'linux';
|
||||||
},
|
},
|
||||||
isNative: function () {
|
isNative: function () {
|
||||||
let native = null;
|
if (this.native === null) {
|
||||||
if (native === null) {
|
|
||||||
try {
|
try {
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
fs.statSync('/var/run/docker.sock');
|
fs.statSync('/var/run/docker.sock');
|
||||||
native = true;
|
this.native = true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (this.isLinux()) {
|
if (this.isLinux()) {
|
||||||
native = true;
|
this.native = true;
|
||||||
} else {
|
} else {
|
||||||
native = false;
|
this.native = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return native;
|
return this.native;
|
||||||
},
|
},
|
||||||
binsPath: function () {
|
binsPath: function () {
|
||||||
return this.isWindows() ? path.join(this.home(), 'Kitematic-bins') : path.join('/usr/local/bin');
|
return this.isWindows() ? path.join(this.home(), 'Kitematic-bins') : path.join('/usr/local/bin');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue