From df9cf8601f642a9ddc9283473f1844ce43b569ec Mon Sep 17 00:00:00 2001 From: Michail Date: Sat, 27 Apr 2024 21:14:55 +0200 Subject: [PATCH] Log track exceptions in the audio handler --- .../java/com/jagrosh/jmusicbot/audio/AudioHandler.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/com/jagrosh/jmusicbot/audio/AudioHandler.java b/src/main/java/com/jagrosh/jmusicbot/audio/AudioHandler.java index 310389dbe..e26211635 100644 --- a/src/main/java/com/jagrosh/jmusicbot/audio/AudioHandler.java +++ b/src/main/java/com/jagrosh/jmusicbot/audio/AudioHandler.java @@ -19,8 +19,10 @@ import com.jagrosh.jmusicbot.queue.AbstractQueue; import com.jagrosh.jmusicbot.settings.QueueType; import com.jagrosh.jmusicbot.settings.RepeatMode; +import com.jagrosh.jmusicbot.utils.OtherUtil; import com.sedmelluq.discord.lavaplayer.player.AudioPlayer; import com.sedmelluq.discord.lavaplayer.player.event.AudioEventAdapter; +import com.sedmelluq.discord.lavaplayer.tools.FriendlyException; import com.sedmelluq.discord.lavaplayer.track.AudioTrack; import com.sedmelluq.discord.lavaplayer.track.AudioTrackEndReason; import com.sedmelluq.discord.lavaplayer.track.playback.AudioFrame; @@ -39,6 +41,7 @@ import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.User; +import org.slf4j.LoggerFactory; /** * @@ -197,6 +200,11 @@ public void onTrackEnd(AudioPlayer player, AudioTrack track, AudioTrackEndReason } } + @Override + public void onTrackException(AudioPlayer player, AudioTrack track, FriendlyException exception) { + LoggerFactory.getLogger("AudioHandler").error("Track " + track.getIdentifier() + " has failed to play", exception); + } + @Override public void onTrackStart(AudioPlayer player, AudioTrack track) {