Skip to content

Commit

Permalink
Fix: handle promise rejection
Browse files Browse the repository at this point in the history
  • Loading branch information
superKalo committed Nov 23, 2017
1 parent 557f50b commit 417ab50
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ class SuperRepo {
*/
this.isPromisePending = true;

return this.promise = new Promise(_resolve => {
return this.promise = new Promise((_resolve, _reject) => {

this.getDataUpToDateStatus().then(_res => {
if (_res.isDataUpToDate) {
Expand All @@ -382,7 +382,8 @@ class SuperRepo {

return _response;
})
.then(_resolve);
.then(_resolve)
.catch(_reject);
}
});

Expand Down Expand Up @@ -416,7 +417,7 @@ class SuperRepo {
const { outOfDateAfter } = this.config;

return new Promise(_resolve => {
this.getDataUpToDateStatus().then(_res => {
this.getDataUpToDateStatus().then((_res, _rej) => {

/**
* If data is up to date, determine when it gets outdated.
Expand Down

0 comments on commit 417ab50

Please sign in to comment.