Skip to content

Commit

Permalink
better null check
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Feb 13, 2024
1 parent da86337 commit 12d33b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/helpers/functions/handleError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export async function handleError(client: Client, error: any, type: string) {
const codeBlocks = error.stack ? "" : "json";

if (error instanceof DiscordAPIError)
// not on our end
// discord's problem (usually), not ours
return console.error(error, type, description);

// silence EPROTO errors
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export async function devLogger(client: Client, description: string, params: Log
const channel = client.channels.cache.get(client.tokens.errorChannel) as TextChannel;
if (!channel) return; // avoid infinite loop when crash is outside of client

if (params.codeBlocks !== null && params.codeBlocks !== undefined)
description = `\`\`\`${params.codeBlocks}\n${description}\`\`\``;
// empty strings still enable codeblocks, just no highlighting
if (params.codeBlocks != null) description = `\`\`\`${params.codeBlocks}\n${description}\`\`\``;

const embed = new EmbedBuilder()
.setTitle(params.title ?? "Unhandled Rejection")
Expand Down

0 comments on commit 12d33b7

Please sign in to comment.