discord-player-play-dl/src/utils/PlayerError.ts

20 lines
432 B
TypeScript
Raw Normal View History

2021-05-10 09:58:37 +05:00
import { Message } from "discord.js";
2021-04-06 19:06:18 +05:00
export default class PlayerError extends Error {
2021-05-10 09:58:37 +05:00
discordMessage: Message;
constructor(msg: string, name?: string, message?: Message) {
2021-04-06 19:06:18 +05:00
super();
2021-04-06 19:08:01 +05:00
this.name = name ?? 'PlayerError';
2021-04-06 19:06:18 +05:00
this.message = msg;
2021-05-10 09:58:37 +05:00
this.discordMessage = message;
2021-04-06 19:06:18 +05:00
Error.captureStackTrace(this);
}
2021-05-10 09:58:37 +05:00
get code() {
return this.name;
}
2021-04-06 19:08:01 +05:00
}
2021-04-06 20:38:17 +05:00
export { PlayerError };