Skip to content
Browse files

Catch exceptions

  • Loading branch information...
1 parent 02f44ba commit 0cc7115079fe32f1bb8b92d110469d5ac2b48b43 @vslinko vslinko committed
Showing with 10 additions and 4 deletions.
  1. +1 −1 package.json
  2. +9 −3 tio.js
View
2 package.json
@@ -1,6 +1,6 @@
{
"name": "tio",
- "version": "0.0.3",
+ "version": "0.0.4",
"description": "tines.io console player",
"keywords": ["tunes.io", "audio", "music", "player"],
"homepage": "https://github.com/rithis/tio",
View
12 tio.js
@@ -32,7 +32,7 @@ if (argv.help) {
optimist.showHelp();
process.exit();
} else if (argv.version) {
- console.log('0.0.3');
+ console.log('0.0.4');
process.exit();
}
@@ -160,7 +160,7 @@ var playNext = function () {
});
};
-var quit = function () {
+var quit = function (err) {
quitScheduled = true;
for (var key in currentDownloads) {
@@ -172,7 +172,12 @@ var quit = function () {
var cleanupAndExit = function () {
nc.cleanup();
- process.exit();
+
+ if (err) {
+ throw err;
+ } else {
+ process.exit();
+ }
};
if (argv.verbose) {
@@ -289,3 +294,4 @@ for (var i = 0; i < argv.t; i++) {
process.on('SIGINT', quit);
process.on('SIGTERM', quit);
+process.on('uncaughtException', quit);

0 comments on commit 0cc7115

Please sign in to comment.
Something went wrong with that request. Please try again.