apploader.js: don't hide errors while loading 'noble'

Loading the module can also fail when e.g. compiled against a different
Node.js version, don't hide those errors.
pull/2120/head
Richard de Boer 2022-09-09 15:01:46 +02:00
parent 23eb487024
commit 0a7f3abb08
No known key found for this signature in database
1 changed files with 9 additions and 6 deletions

View File

@ -16,12 +16,15 @@ var SETTINGS = {
};
var APPSDIR = __dirname+"/../apps/";
var noble;
try {
noble = require('@abandonware/noble');
} catch (e) {}
if (!noble) try {
noble = require('noble');
} catch (e) { }
["@abandonware/noble", "noble"].forEach(module => {
if (!noble) try {
noble = require(module);
} catch(e) {
if (e.code !== 'MODULE_NOT_FOUND') {
throw e;
}
}
});
if (!noble) {
console.log("You need to:")
console.log(" npm install @abandonware/noble")