always log errors to console

This commit is contained in:
Feross Aboukhadijeh
2016-03-20 16:11:59 -07:00
parent da702907b4
commit fa3ca50d8f

View File

@@ -53,8 +53,11 @@ function init () {
state.client.on('warning', onWarning) state.client.on('warning', onWarning)
state.client.on('error', function (err) { state.client.on('error', function (err) {
// TODO: WebTorrent should have semantic errors // TODO: WebTorrent should have semantic errors
if (err.message.startsWith('There is already a swarm')) onError('Couldn\'t add duplicate torrent') if (err.message.startsWith('There is already a swarm')) {
else onError(err) onError(new Error('Couldn\'t add duplicate torrent'))
} else {
onError(err)
}
}) })
resumeTorrents() /* restart everything we were torrenting last time the app ran */ resumeTorrents() /* restart everything we were torrenting last time the app ran */
@@ -693,7 +696,7 @@ function restoreBounds () {
} }
function onError (err) { function onError (err) {
if (err.stack) console.error(err.stack) console.error(err.stack || err)
playInterfaceSound(config.SOUND_ERROR) playInterfaceSound(config.SOUND_ERROR)
state.errors.push({ state.errors.push({
time: new Date().getTime(), time: new Date().getTime(),