mirror of
https://github.com/artiemis/artemis.js.git
synced 2026-02-14 10:21:54 +00:00
29 lines
745 B
TypeScript
29 lines
745 B
TypeScript
import { codeBlock, type TextChannel } from "discord.js";
|
|
import { client } from "../client";
|
|
import { env } from "../env";
|
|
|
|
export class ExplicitCommandError extends Error {}
|
|
|
|
export function abort(message: string): never {
|
|
throw new ExplicitCommandError(message);
|
|
}
|
|
|
|
export function isExplicitCommandError(
|
|
error: any
|
|
): error is ExplicitCommandError {
|
|
return error instanceof ExplicitCommandError;
|
|
}
|
|
|
|
export async function notifyError(trace: string, error: any) {
|
|
return (client.channels.cache.get(env.DEV_CHANNEL_ID) as TextChannel).send({
|
|
content: trace,
|
|
embeds: [
|
|
{
|
|
title: "Unhandled Error",
|
|
description: codeBlock("js", error.stack ?? error.message),
|
|
color: 0xff0000,
|
|
},
|
|
],
|
|
});
|
|
}
|