Skip to content
This repository was archived by the owner on Jul 7, 2024. It is now read-only.

Commit

Permalink
core: command failure logging
Browse files Browse the repository at this point in the history
  • Loading branch information
zleyyij committed Jun 22, 2023
1 parent 51f4bcb commit dea5787
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/core/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,25 @@ function listen(): void {
.executeCommand(tokens.join(' '), message)
.then((value: void | APIEmbed) => {
// enable modules to return an embed
if (value != null) {
void message.reply({embeds: [value]});
if (value !== null) {
void message.reply({embeds: [value!]});
}
})
.catch((err: Error) => {
eventLogger.logEvent(
{
category: EventCategory.Error,
location: 'core',
description:
`Encountered an error running command ${currentModule.command}:` +
'```' +
err.name +
'\n' +
err.stack +
'```',
},
3
);
void message.reply({
embeds: [
embed.errorEmbed(
Expand Down

0 comments on commit dea5787

Please sign in to comment.