log unhandled exceptions

This commit is contained in:
Eugene Mirotin 2017-04-21 13:10:30 +03:00
parent 75d10286ad
commit 225d3acf9e
6 changed files with 19 additions and 12 deletions

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
- Capture and report errors happening during the program initialization, like parsing invalid YAML config
## [5.7.2] - 2017-04-18
### Fixed

View File

@ -53,12 +53,12 @@ module.exports = {
}
],
action: function(params, options, done) {
var Promise, child_process, patterns, resin, settings, verbose;
var Promise, child_process, patterns, proxyUrl, resin, verbose;
child_process = require('child_process');
Promise = require('bluebird');
resin = require('resin-sdk-preconfigured');
settings = require('resin-settings-client');
patterns = require('../utils/patterns');
proxyUrl = resin.settings.get('proxyUrl');
if (options.port == null) {
options.port = 22;
}
@ -92,7 +92,7 @@ module.exports = {
}
return Promise["try"](function() {
var command, subShellCommand;
command = "ssh " + verbose + " -t -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ControlMaster=no -p " + options.port + " " + username + "@ssh." + (settings.get('proxyUrl')) + " enter " + uuid + " " + containerId;
command = "ssh " + verbose + " -t -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ControlMaster=no -p " + options.port + " " + username + "@ssh." + proxyUrl + " enter " + uuid + " " + containerId;
subShellCommand = getSubShellCommand(command);
return child_process.spawn(subShellCommand.program, subShellCommand.args, {
stdio: 'inherit'

View File

@ -24,7 +24,10 @@ Raven.disableConsoleAlerts();
Raven.config(require('./config').sentryDsn, {
captureUnhandledRejections: true,
release: require('../package.json').version
}).install();
}).install(function(logged, error) {
console.error(error);
return process.exit(1);
});
_ = require('lodash');

View File

@ -70,8 +70,8 @@ module.exports =
child_process = require('child_process')
Promise = require 'bluebird'
resin = require('resin-sdk-preconfigured')
settings = require('resin-settings-client')
patterns = require('../utils/patterns')
proxyUrl = resin.settings.get('proxyUrl')
if not options.port?
options.port = 22
@ -92,7 +92,8 @@ module.exports =
Promise.props
username: resin.auth.whoami()
uuid: device.uuid # get full uuid
uuid: device.uuid
# get full uuid
containerId: resin.models.device.getApplicationInfo(device.uuid).get('containerId')
.then ({ username, uuid, containerId }) ->
throw new Error('Did not find running application container') if not containerId?
@ -102,7 +103,7 @@ module.exports =
-o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null \
-o ControlMaster=no \
-p #{options.port} #{username}@ssh.#{settings.get('proxyUrl')} enter #{uuid} #{containerId}"
-p #{options.port} #{username}@ssh.#{proxyUrl} enter #{uuid} #{containerId}"
subShellCommand = getSubShellCommand(command)
child_process.spawn subShellCommand.program, subShellCommand.args,

View File

@ -16,11 +16,12 @@ limitations under the License.
Raven = require('raven')
Raven.disableConsoleAlerts()
Raven.config(
require('./config').sentryDsn
Raven.config require('./config').sentryDsn,
captureUnhandledRejections: true
release: require('../package.json').version
).install()
.install (logged, error) ->
console.error(error)
process.exit(1)
_ = require('lodash')
Promise = require('bluebird')

View File

@ -44,7 +44,6 @@
"etcher-image-write": "^9.0.3",
"inquirer": "^3.0.6",
"is-root": "^1.0.0",
"js-yaml": "^3.7.0",
"lodash": "^3.10.0",
"mixpanel": "^0.4.0",
"moment": "^2.12.0",
@ -63,7 +62,6 @@
"resin-image-fs": "^2.1.2",
"resin-image-manager": "^4.1.1",
"resin-sdk-preconfigured": "^6.0.0",
"resin-settings-client": "^3.5.0",
"resin-sync": "^7.0.0",
"rimraf": "^2.4.3",
"rindle": "^1.0.0",