From ac2f99eb75ea0295dc08e47b91f4b4d54829d004 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sun, 7 Feb 2016 12:01:40 +0100 Subject: Don't use process.exit, throw an error instead --- lib/webtorrent.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/webtorrent.js') diff --git a/lib/webtorrent.js b/lib/webtorrent.js index 5f10322a5..cb641fead 100644 --- a/lib/webtorrent.js +++ b/lib/webtorrent.js @@ -43,8 +43,7 @@ function create (options, callback) { // Run a timeout of 30s after which we exit the process var timeout_webtorrent_process = setTimeout(function () { - logger.error('Timeout : cannot run the webtorrent process. Please ensure you have electron-prebuilt npm package installed with xvfb-run.') - process.exit() + throw new Error('Timeout : cannot run the webtorrent process. Please ensure you have electron-prebuilt npm package installed with xvfb-run.') }, 30000) ipc.server.on(processKey + '.ready', function () { @@ -54,8 +53,7 @@ function create (options, callback) { }) ipc.server.on(processKey + '.exception', function (data) { - logger.error('Received exception error from webtorrent process.', { exception: data.exception }) - process.exit() + throw new Error('Received exception error from webtorrent process.' + data.exception) }) var webtorrent_process = spawn(pathUtils.join(__dirname, 'webtorrentProcess.js'), host, port, { detached: true }) -- cgit v1.2.3