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