Promise.prototype.finally polyfill Promise.prototype.finally = callback => { return this.then(value => { return Promise.resolve(callback()).then(() => value) }, error => { return Promise.resolve(callback()).then(() => throw error) }) }