diff options
-rwxr-xr-x | bin/cmd.js | 7 | ||||
-rw-r--r-- | index.js | 4 |
2 files changed, 8 insertions, 3 deletions
@@ -87,7 +87,12 @@ client.on('error', function (err) { clivas.line('{red:error} ' + err) }) -client.add(torrentId, function (torrent) { +client.add(torrentId, function (err, torrent) { + if (err) { + clivas.line('{red:error} ' + err) + process.exit(1) + } + function updateMetadata () { if (torrent) { clivas.clear() @@ -60,8 +60,8 @@ WebTorrent.prototype.add = function (torrentId, cb) { // assume it's a filesystem path fs.readFile(torrentId, function (err, torrent) { if (err) { - return cb(new Error('Cannot add torrent. Require one of: magnet uri, ' + - 'info hash, torrent file, http url, or filesystem path')) + return cb(new Error('Cannot add torrent "' + torrentId + '". Torrent id must be one of: magnet uri, ' + + 'info hash, torrent file, http url, or filesystem path.')) } onTorrentId(torrent) }) |