Move logging to loadCharacters

main
Mari 7 months ago
parent df61a3fdf5
commit a2f30f5cfc
  1. 10
      src/commands/base.ts

@ -212,7 +212,10 @@ export abstract class AbstractCharacterStatusCommand extends SlashCommand {
Array.from(names).map((name) =>
loadCharacter(this.dataDir, name)
.then<LoadedCharacterData>((c) => ({ name, success: true, originalData: c }))
.catch<ErrorCharacterData>((e) => ({ name, success: false, error: e }))
.catch<ErrorCharacterData>((e) => {
console.error(`While loading ${name}: `, e)
return { name, success: false, error: e }
})
)
);
}
@ -229,11 +232,6 @@ export abstract class AbstractCharacterStatusCommand extends SlashCommand {
}
}
const loadedCharacters = await this.loadCharacters(neededCharacters);
for (const char of loadedCharacters) {
if (!char.success) {
console.error(`While loading ${char.name}: `, char.error)
}
}
const characterMap = new Map<string, GameCharacterData>();
for (const character of loadedCharacters) {
characterMap.set(character.name, character);

Loading…
Cancel
Save