Refactor promise chains to avoid .finally

Use of .then following a use of .catch works the same as .finally.

Bug: Issue 9650
Change-Id: Ic83b21e357141fbe889ad4e82c59eef222fa4847
This commit is contained in:
Wyatt Allen
2018-08-28 11:47:13 -07:00
parent a8175cd8a1
commit 4ec561538c
2 changed files with 15 additions and 12 deletions

View File

@@ -254,17 +254,20 @@
return this._loadDiffAssets(diff);
});
return Promise.all([diffRequest, assetRequest]).then(results => {
const diff = results[0];
if (!diff) {
return Promise.resolve();
}
this.filesWeblinks = this._getFilesWeblinks(diff);
this._diff = diff;
return this._renderDiffTable();
}).finally(() => {
this._loading = false;
});
return Promise.all([diffRequest, assetRequest])
.then(results => {
const diff = results[0];
if (!diff) {
return Promise.resolve();
}
this.filesWeblinks = this._getFilesWeblinks(diff);
this._diff = diff;
return this._renderDiffTable();
})
.catch(err => {
console.warn('Error encountered loading diff:', err);
})
.then(() => { this._loading = false; });
},
/** Cancel any remaining diff builder rendering work. */