]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - lib/webtorrent.js
Don't use process.exit, throw an error instead
[github/Chocobozzz/PeerTube.git] / lib / webtorrent.js
index 5f10322a5d82953c026f9976eed9373cd50af615..cb641feada355df5958aaa33b7bd59f89f8b91d6 100644 (file)
@@ -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 })