Skip to content

Commit 12aeebf

Browse files
committed
Handle rejected promises
1 parent 75de13b commit 12aeebf

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/utils/callcallback.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@
55

66
export default function callCallback(promise, callback) {
77
if (callback) {
8-
promise.then((result) => {
9-
callback(undefined, result);
10-
return result;
11-
});
8+
promise
9+
.then(result => {
10+
callback(undefined, result);
11+
return result;
12+
})
13+
.catch(error => {
14+
callback(error);
15+
});
1216
}
1317
return promise;
1418
}

0 commit comments

Comments
 (0)