Add a user-facing error when the Database is misconfigured.

This commit is contained in:
Oliver-Akins 2025-05-19 23:22:17 -06:00
parent 142586536a
commit b717b0060b
2 changed files with 9 additions and 1 deletions

View file

@ -43,7 +43,7 @@ Hooks.on(`init`, () => {
if (import.meta.env.DEV) {
CONFIG.stats.db = MemoryDatabase;
}
};
Handlebars.registerHelper(helpers);
registerCustomComponents();

View file

@ -1,5 +1,13 @@
import { Database } from "../utils/databases/Database.mjs";
import { Logger } from "../utils/Logger.mjs";
Hooks.on(`ready`, () => {
Logger.log(`Version: ${__VERSION__}`);
// Alert GMs when the configured DB is invalid
if (!(CONFIG.stats.db.prototype instanceof Database) && game.user.isGM) {
ui.notifications.error(`The database handler does not conform to the required heirarchy, the stats tracker module will almost certainly not work correctly.`, { permanent: true });
} else {
CONFIG.stats.db.registerListeners();
};
});