Skip to content

Commit f51a9ae

Browse files
committed
Not to use Promise#finally() to avoid error
1 parent 592cfd3 commit f51a9ae

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/timekeeper.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,15 @@
195195
}
196196
// If callback is async function
197197
if (typeof Promise !== 'undefined' && result instanceof Promise) {
198-
result.finally(function() {
199-
// Reset
200-
timekeeper.reset();
201-
});
198+
result
199+
.then(function() {
200+
// Reset
201+
timekeeper.reset();
202+
})
203+
.catch(function() {
204+
// Reset
205+
timekeeper.reset();
206+
});
202207
return result;
203208
} else {
204209
// Reset

0 commit comments

Comments
 (0)