Added an error parameter to PrintUtils#error to allow logging of an accompany Error obj

This commit is contained in:
Kallum Jones
2022-08-03 17:18:21 +01:00
parent 6b700d465b
commit fc18d70e49
3 changed files with 12 additions and 3 deletions

View File

@ -1,5 +1,6 @@
import chalk from "chalk";
import ora, {Ora} from "ora";
import ModManager from "../mod-manager.js";
export default class PrintUtils {
@ -51,7 +52,13 @@ export default class PrintUtils {
console.log(chalk.greenBright(print));
}
static error(print: string) {
static error(print: string, err?: Error) {
console.log(chalk.redBright(print));
if (err instanceof Error) {
if (ModManager.logger != null) {
ModManager.logger.error(err)
}
}
}
}