Skip to content

Commit

Permalink
Log track exceptions in the audio handler (jagrosh#1558)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichailiK authored May 10, 2024
1 parent 48e62f1 commit 8557f7a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/com/jagrosh/jmusicbot/audio/AudioHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
import com.jagrosh.jmusicbot.settings.QueueType;
import com.jagrosh.jmusicbot.utils.TimeUtil;
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;
Expand All @@ -40,6 +42,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;

/**
*
Expand Down Expand Up @@ -199,6 +202,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)
{
Expand Down

0 comments on commit 8557f7a

Please sign in to comment.