Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
302 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 | module.exports = (promise, onFinally) => {
|
---|
3 | onFinally = onFinally || (() => {});
|
---|
4 |
|
---|
5 | return promise.then(
|
---|
6 | val => new Promise(resolve => {
|
---|
7 | resolve(onFinally());
|
---|
8 | }).then(() => val),
|
---|
9 | err => new Promise(resolve => {
|
---|
10 | resolve(onFinally());
|
---|
11 | }).then(() => {
|
---|
12 | throw err;
|
---|
13 | })
|
---|
14 | );
|
---|
15 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.