2025-05-07 07:27:41 -04:00
|
|
|
// TODO: Improve how messages are stringified
|
2025-09-24 07:57:50 -05:00
|
|
|
const ChatMessage = require("prismarine-chat")("1.21.8");
|
2025-05-07 07:27:41 -04:00
|
|
|
const stringify = (message) => new ChatMessage(message)?.toString();
|
|
|
|
|
|
|
|
|
|
class CommandError extends Error {
|
2025-09-12 12:54:08 -05:00
|
|
|
constructor(message, filename, lineError) {
|
|
|
|
|
super(stringify(message), filename, lineError);
|
2025-05-07 07:27:41 -04:00
|
|
|
this.name = "CommandError";
|
|
|
|
|
this._message = message;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get message() {
|
|
|
|
|
return stringify(this._message);
|
|
|
|
|
}
|
2025-08-22 11:52:57 -05:00
|
|
|
}
|
|
|
|
|
module.exports = CommandError;
|