Use promise then() instead of catch() with callbacks

Addresses my review here: https://github.com/webtorrent/webtorrent-desktop/pull/1419#pullrequestreview-285182318
This commit is contained in:
Feross Aboukhadijeh
2019-09-07 11:10:53 -07:00
parent 647eaf5af9
commit dd13de5f65
2 changed files with 13 additions and 7 deletions

View File

@@ -151,8 +151,10 @@ function setupStateSaved (cb) {
})
Promise.all(tasks)
.then(() => cb(null, saved))
.catch(err => cb(err))
.then(
() => cb(null, saved),
err => cb(err)
)
function createTorrentObject (t) {
// TODO: Doing several fs.readFileSync calls during first startup is not ideal