Skip to content

Commit

Permalink
Log track exceptions in the audio handler
Browse files Browse the repository at this point in the history
  • Loading branch information
MichailiK committed Apr 27, 2024
1 parent b3ffbdb commit df9cf86
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 @@ -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;
Expand All @@ -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;

/**
*
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit df9cf86

Please sign in to comment.