Skip to content

Commit 5654235

Browse files
committed
Rethrow some errors as suspicious
1 parent 978efc6 commit 5654235

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

common/src/main/java/dev/lavalink/youtube/track/YoutubeAudioTrack.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,18 @@ public void process(LocalAudioTrackExecutor localExecutor) throws Exception {
9797

9898
if (lastException != null) {
9999
if (lastException instanceof FriendlyException) {
100+
if (!"YouTube WebM streams are currently not supported.".equals(lastException.getMessage())) {
101+
// Rethrow certain FriendlyExceptions as suspicious to ensure LavaPlayer logs them.
102+
throw new FriendlyException(lastException.getMessage(), Severity.SUSPICIOUS, lastException.getCause());
103+
}
104+
100105
throw lastException;
101106
}
102107

103108
throw ExceptionTools.toRuntimeException(lastException);
104109
}
105110
} catch (CannotBeLoaded e) {
106-
throw ExceptionTools.wrapUnfriendlyExceptions("This video is unavailable", Severity.COMMON, e.getCause());
111+
throw ExceptionTools.wrapUnfriendlyExceptions("This video is unavailable", Severity.SUSPICIOUS, e.getCause());
107112
}
108113
}
109114

@@ -188,7 +193,7 @@ private FormatWithUrl loadBestFormatWithUrl(@NotNull HttpInterface httpInterface
188193
TrackFormats formats = client.loadFormats(sourceManager, httpInterface, getIdentifier());
189194

190195
if (formats == null) {
191-
throw new FriendlyException("This video cannot be played", Severity.COMMON, null);
196+
throw new FriendlyException("This video cannot be played", Severity.SUSPICIOUS, null);
192197
}
193198

194199
StreamFormat format = formats.getBestFormat();

0 commit comments

Comments
 (0)