error handling

This commit is contained in:
siikamiika 2020-03-22 14:39:07 +02:00
parent 9f9ea1d5fb
commit 7928c5d713

View File

@ -129,19 +129,29 @@ class PopupProxy {
if (this._frameOffsetPromise === null && !expired) { return; } if (this._frameOffsetPromise === null && !expired) { return; }
if (this._frameOffsetPromise !== null) { if (this._frameOffsetPromise !== null) {
if (firstRun) {
await this._frameOffsetPromise; await this._frameOffsetPromise;
}
return; return;
} }
if (firstRun) {
this._frameOffsetPromise = this._getFrameOffset(); this._frameOffsetPromise = this._getFrameOffset();
if (firstRun) {
try {
this._frameOffset = await this._frameOffsetPromise; this._frameOffset = await this._frameOffsetPromise;
this._frameOffsetPromise = null;
this._frameOffsetUpdatedAt = Date.now(); this._frameOffsetUpdatedAt = Date.now();
} catch (e) {
console.error(e);
}
this._frameOffsetPromise = null;
} else { } else {
this._getFrameOffset().then((offset) => { this._frameOffsetPromise.then((offset) => {
this._frameOffset = offset; this._frameOffset = offset;
this._frameOffsetUpdatedAt = Date.now(); this._frameOffsetUpdatedAt = Date.now();
this._frameOffsetPromise = null;
}, (e) => {
console.error(e);
this._frameOffsetPromise = null;
}); });
} }
} }