Permalink
Browse files

[fix] small fixes in try/catch JSON.parse

  • Loading branch information...
1 parent 1b43fcc commit d5bf8047b88f8c3960ee40544f49ce343e3570a6 @alejandro alejandro committed Apr 7, 2012
Showing with 16 additions and 6 deletions.
  1. +7 −2 lib/app.js
  2. +7 −2 proxy/proxy.js
  3. +2 −2 scripts/chroot_runner.js
View
@@ -808,7 +808,12 @@ var app_stop = function (repo_id, callback, skip_unmount) {
var pid = parseInt(data.toString(), 10);
if (pid > 0) {
try {
- process.kill(pid, 'SIGINT');
+ /* tryception ? */
+ try {
+ process.kill(pid);
+ } catch(e) {
+ log.warn('App Stop action failed => %s',e.message)
+ }
var app_home = path.join(cfg.apps_home_dir, doc.username, repo_id);
var app_rw = app_home + '_rw';
var app_chroot = app_home + '_chroot';
@@ -817,7 +822,7 @@ var app_stop = function (repo_id, callback, skip_unmount) {
tearDown(cfg.node_base_folder, app_home, app_rw, app_chroot, function () {});
} catch (e) {
- log.warn('App Stop action failed => %s',e.message)
+ log.warn('tearDown action failed => %s',e.message)
}
callback(true);
} else {
View
@@ -34,8 +34,13 @@ fs.watchFile(config.opt.proxy_table_file, function (oldts, newts) {
log.info('Proxy map failed to update! (read)')
throw err;
} else {
- proxymap = JSON.parse(data);
- log.info('Proxy map updated')
+ try {
+ proxymap = JSON.parse(data);
+ log.info('Proxy map updated')
+ } catch(e){
+ log.warn(e)
+ }
+
}
});
});
View
@@ -13,7 +13,7 @@ var spawn = require('child_process').spawn
, config = JSON.parse(fs.readFileSync(path.join('.nodester', 'config.json'),'utf8'))
, cfg = require('../config').opt
, newmask = 0000
- , log = new Logger({name: "nodester"})
+ , log = process.log || new Logger({name: "nodester"})
, run_max = 5
, run_count = 0
, LOG_STDOUT = 1
@@ -23,7 +23,7 @@ var spawn = require('child_process').spawn
oldmask = process.umask(newmask);
- log.info('Changed umask from: ' + oldmask.toString(8) + ' to ' + newmask.toString(8));
+log.info('Changed umask from: ' + oldmask.toString(8) + ' to ' + newmask.toString(8));
var env = {
PATH: '/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin',

0 comments on commit d5bf804

Please sign in to comment.