Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/cmd.js7
-rw-r--r--index.js4
2 files changed, 8 insertions, 3 deletions
diff --git a/bin/cmd.js b/bin/cmd.js
index 1025a7a..bdf7558 100755
--- a/bin/cmd.js
+++ b/bin/cmd.js
@@ -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()
diff --git a/index.js b/index.js
index 318a76d..4a2ac45 100644
--- a/index.js
+++ b/index.js
@@ -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)
})