Print error and stacktrace when package fails to load
This commit is contained in:
parent
a658d768d2
commit
b96e5cc042
@ -65,23 +65,22 @@ function loadPackages() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
packages.forEach((packageName) => {
|
packages.forEach((packageName) => {
|
||||||
const errorMsg = `Package ${colors.bold(packageName)} could not be loaded`;
|
|
||||||
let packageInfo;
|
let packageInfo;
|
||||||
let packageFile;
|
let packageFile;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
packageInfo = require(path.join(
|
const packagePath = Helper.getPackageModulePath(packageName);
|
||||||
Helper.getPackageModulePath(packageName),
|
|
||||||
"package.json"
|
packageInfo = require(path.join(packagePath, "package.json"));
|
||||||
));
|
|
||||||
packageFile = require(Helper.getPackageModulePath(packageName));
|
|
||||||
} catch (e) {
|
|
||||||
log.warn(errorMsg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!packageInfo.thelounge) {
|
if (!packageInfo.thelounge) {
|
||||||
log.warn(errorMsg);
|
throw "'thelounge' is not present in package.json";
|
||||||
|
}
|
||||||
|
|
||||||
|
packageFile = require(packagePath);
|
||||||
|
} catch (e) {
|
||||||
|
log.error(`Package ${colors.bold(packageName)} could not be loaded: ${colors.red(e)}`);
|
||||||
|
log.debug(e.stack);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user