mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-09 00:15:13 -04:00
Improve exception handling
This commit is contained in:
parent
52085ca145
commit
b014163813
1 changed files with 12 additions and 13 deletions
|
@ -17,25 +17,24 @@ const loadEtherpadInformations = () => {
|
||||||
|
|
||||||
return axios.get('https://static.etherpad.org/info.json', {headers: headers})
|
return axios.get('https://static.etherpad.org/info.json', {headers: headers})
|
||||||
.then(async resp => {
|
.then(async resp => {
|
||||||
try {
|
infos = await resp.data;
|
||||||
infos = await resp.data;
|
if (infos === undefined || infos === null) {
|
||||||
if (infos === undefined || infos === null) {
|
await Promise.reject("Could not retrieve current version")
|
||||||
await Promise.reject("Could not retrieve current version")
|
return
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
lastLoadingTime = Date.now();
|
|
||||||
return await Promise.resolve(infos);
|
|
||||||
} catch (err) {
|
|
||||||
return await Promise.reject(err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastLoadingTime = Date.now();
|
||||||
|
return await Promise.resolve(infos);
|
||||||
})
|
})
|
||||||
|
.catch(async err => {
|
||||||
|
return await Promise.reject(err);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exports.getLatestVersion = () => {
|
exports.getLatestVersion = () => {
|
||||||
exports.needsUpdate();
|
exports.needsUpdate().catch();
|
||||||
return infos.latestVersion;
|
return infos?.latestVersion;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.needsUpdate = async (cb) => {
|
exports.needsUpdate = async (cb) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue