adding more logging for lash command exceptions

This commit is contained in:
Sheldan
2022-08-19 15:56:23 +02:00
parent f24552fdf2
commit 9c621954c8

View File

@@ -76,11 +76,16 @@ public class SlashCommandListenerBean extends ListenerAdapter {
@Override @Override
public void onSlashCommandInteraction(@NotNull SlashCommandInteractionEvent event) { public void onSlashCommandInteraction(@NotNull SlashCommandInteractionEvent event) {
if(commands == null || commands.isEmpty()) return; try {
CompletableFuture.runAsync(() -> self.executeListenerLogic(event), slashCommandExecutor).exceptionally(throwable -> { if(commands == null || commands.isEmpty()) return;
log.error("Failed to execute listener logic in async slash command event.", throwable); log.debug("Executing slash command in guild {} from user {}.", event.getGuild().getIdLong(), event.getMember().getIdLong());
return null; CompletableFuture.runAsync(() -> self.executeListenerLogic(event), slashCommandExecutor).exceptionally(throwable -> {
}); log.error("Failed to execute listener logic in async slash command event.", throwable);
return null;
});
} catch (Exception exception) {
log.error("Failed to process slash command interaction event.", exception);
}
} }
@Transactional @Transactional
@@ -107,11 +112,15 @@ public class SlashCommandListenerBean extends ListenerAdapter {
@Override @Override
public void onCommandAutoCompleteInteraction(@NotNull CommandAutoCompleteInteractionEvent event) { public void onCommandAutoCompleteInteraction(@NotNull CommandAutoCompleteInteractionEvent event) {
if(commands == null || commands.isEmpty()) return; try {
CompletableFuture.runAsync(() -> self.executeAutCompleteListenerLogic(event), slashCommandAutoCompleteExecutor).exceptionally(throwable -> { if(commands == null || commands.isEmpty()) return;
log.error("Failed to execute listener logic in async auto complete interaction event.", throwable); CompletableFuture.runAsync(() -> self.executeAutCompleteListenerLogic(event), slashCommandAutoCompleteExecutor).exceptionally(throwable -> {
return null; log.error("Failed to execute listener logic in async auto complete interaction event.", throwable);
}); return null;
});
} catch (Exception e) {
log.error("Failed to process slash command auto complete interaction.", e);
}
} }
@Transactional @Transactional