Fix: bump db-to-cloud, show detailed LockError
This commit is contained in:
parent
50185be40b
commit
8731be73c0
|
@ -1669,6 +1669,14 @@
|
||||||
"message": "Sync failed.\nTry to re-login in Stylus options:\nclick 'disconnect' first, then 'connect'.",
|
"message": "Sync failed.\nTry to re-login in Stylus options:\nclick 'disconnect' first, then 'connect'.",
|
||||||
"description": "Tooltip for the toolbar icon"
|
"description": "Tooltip for the toolbar icon"
|
||||||
},
|
},
|
||||||
|
"syncErrorLock": {
|
||||||
|
"message": "The database is already in used. The lock will expire at $TIME$",
|
||||||
|
"placeholders": {
|
||||||
|
"time": {
|
||||||
|
"content": "$1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"syncStorageErrorSaving": {
|
"syncStorageErrorSaving": {
|
||||||
"message": "The value cannot be saved. Try reducing the amount of text.",
|
"message": "The value cannot be saved. Try reducing the amount of text.",
|
||||||
"description": "Displayed when trying to save an excessively big value via storage.sync API"
|
"description": "Displayed when trying to save an excessively big value via storage.sync API"
|
||||||
|
|
|
@ -154,6 +154,7 @@ const syncMan = (() => {
|
||||||
status.errorMessage = null;
|
status.errorMessage = null;
|
||||||
lastError = null;
|
lastError = null;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
err.message = translateErrorMessage(err);
|
||||||
status.errorMessage = err.message;
|
status.errorMessage = err.message;
|
||||||
lastError = err;
|
lastError = err;
|
||||||
if (isScheduled &&
|
if (isScheduled &&
|
||||||
|
@ -208,6 +209,7 @@ const syncMan = (() => {
|
||||||
setState(drive, state) {
|
setState(drive, state) {
|
||||||
return chromeLocal.setValue(STORAGE_KEY + drive.name, state);
|
return chromeLocal.setValue(STORAGE_KEY + drive.name, state);
|
||||||
},
|
},
|
||||||
|
retryMaxAttempts: 0,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,5 +262,12 @@ const syncMan = (() => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function translateErrorMessage(err) {
|
||||||
|
if (err.name === 'LockError') {
|
||||||
|
return browser.i18n.getMessage('syncErrorLock', new Date(err.expire).toLocaleString([], {timeStyle: 'short'}));
|
||||||
|
}
|
||||||
|
return err.message || String(err);
|
||||||
|
}
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user