Skip to content

Commit

Permalink
sync log errors (#1901)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrepimenta authored Oct 26, 2020
1 parent a7d6c01 commit c37fe93
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/util/syncWithExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default class PubNubWrapper {
sendByPost: false,
storeInHistory: false
},
() => {
(status, response) => {
setTimeout(() => {
if (this.timeout) {
const error = new Error('Sync::timeout');
Expand All @@ -65,6 +65,10 @@ export default class PubNubWrapper {
resolve();
}
}, EXPIRED_CODE_TIMEOUT);

if (status && status.error) {
Logger.error(new Error('Sync::error-startSync'), { ...status, ...response });
}
}
);
});
Expand Down Expand Up @@ -115,7 +119,7 @@ export default class PubNubWrapper {
sendByPost: false,
storeInHistory: false
},
() => {
(status, response) => {
this.disconnectWebsockets();
this.pubnub = new PubNub({
subscribeKey: SUB_KEY,
Expand All @@ -126,6 +130,10 @@ export default class PubNubWrapper {
this.channelName = channelName;
this.cipherKey = cipherKey;
resolve();

if (status && status.error) {
Logger.error(new Error('Sync::error-establishConnection'), { ...status, ...response });
}
}
);
});
Expand Down

0 comments on commit c37fe93

Please sign in to comment.