Show an error when adding an invalid magnet link (#428)

Fixes #386
This commit is contained in:
DC
2016-04-19 20:09:28 -07:00
parent 06f81ff759
commit 812ce8724d

View File

@@ -68,10 +68,15 @@ function init () {
// See https://github.com/feross/webtorrent/blob/master/docs/api.md#clientaddtorrentid-opts-function-ontorrent-torrent- // See https://github.com/feross/webtorrent/blob/master/docs/api.md#clientaddtorrentid-opts-function-ontorrent-torrent-
function startTorrenting (torrentKey, torrentID, path, fileModtimes) { function startTorrenting (torrentKey, torrentID, path, fileModtimes) {
console.log('starting torrent %s: %s', torrentKey, torrentID) console.log('starting torrent %s: %s', torrentKey, torrentID)
var torrent = client.add(torrentID, { var torrent
path: path, try {
fileModtimes: fileModtimes torrent = client.add(torrentID, {
}) path: path,
fileModtimes: fileModtimes
})
} catch (err) {
return ipc.send('wt-error', torrentKey, err.message)
}
torrent.key = torrentKey torrent.key = torrentKey
addTorrentEvents(torrent) addTorrentEvents(torrent)
return torrent return torrent