Improve development errors

- Fixes #1029
- Fixes #1028
This commit is contained in:
Zack Rauen 2022-02-04 16:23:21 -05:00
parent 3c976a9483
commit 854afc27cf
3 changed files with 5 additions and 4 deletions

View File

@ -206,7 +206,7 @@
"metaError": "META could not be parsed.",
"missingNameData": "META missing name data.",
"metaNotFound": "META was not found.",
"compileError": "Could not be compiled.",
"compileError": "Could not be compiled. See console for details.",
"wasUnloaded": "{{name}} was unloaded.",
"blankSlateHeader": "You don't have any {{type}}s!",
"blankSlateMessage": "Grab some from [this website]({{link}}) and add them to your {{type}} folder."

View File

@ -209,7 +209,7 @@ export default class AddonManager {
__non_webpack_require__(path.resolve(this.addonFolder, filename));
}
catch (error) {
Logger.err(this.name, `Could not load ${path.basename(filename)}:`, error);
Logger.stacktrace(this.name, `Could not load ${path.basename(filename)}:`, error);
return new AddonError(filename, filename, Strings.Addons.compileError, {message: error.message, stack: error.stack}, this.prefix);
}

View File

@ -75,12 +75,13 @@ export default new class PluginManager extends AddonManager {
/* Overrides */
initializeAddon(addon) {
if (!addon.exports) return new AddonError(addon.name, addon.filename, "Plugin had no exports", {message: "Plugin had no exports or no name property.", stack: ""}, this.prefix);
if (!addon.exports || !addon.name) return new AddonError(addon.name || addon.filename, addon.filename, "Plugin had no exports or @name property", {message: "Plugin had no exports or no @name property. @name property is required for all addons.", stack: ""}, this.prefix);
try {
const PluginClass = addon.exports;
const thePlugin = new PluginClass();
addon.instance = thePlugin;
addon.name = thePlugin.getName ? thePlugin.getName() : addon.name || "No name";
addon.name = thePlugin.getName ? thePlugin.getName() : addon.name;
addon.author = thePlugin.getAuthor ? thePlugin.getAuthor() : addon.author || "No author";
addon.description = thePlugin.getDescription ? thePlugin.getDescription() : addon.description || "No description";
addon.version = thePlugin.getVersion ? thePlugin.getVersion() : addon.version || "No version";