Skip to content

Commit

Permalink
Related to #172, changing ordering in case of success to ensure that …
Browse files Browse the repository at this point in the history
…references to state are correctly set before clearing promise reference and displaying error message if the async request fails
  • Loading branch information
peter-murray committed May 31, 2020
1 parent f982706 commit eaf3c88
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/api/Api.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,12 @@ module.exports = class Api {
}

self._syncPromise = self._syncPromise.then(data => {
self._syncPromise = null;
self._state = new Cache(data);
self._lastSyncTime = new Date().getTime();
self._syncPromise = null;
})
.catch(() => {
.catch(err => {
console.error(`Failed to async load the bridge configuration data; ${err}`);
self._syncPromise = null;
});
}
Expand Down

0 comments on commit eaf3c88

Please sign in to comment.