Skip to content

Commit

Permalink
Rethrow some errors as suspicious
Browse files Browse the repository at this point in the history
  • Loading branch information
devoxin committed Sep 1, 2024
1 parent 978efc6 commit 5654235
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,18 @@ public void process(LocalAudioTrackExecutor localExecutor) throws Exception {

if (lastException != null) {
if (lastException instanceof FriendlyException) {
if (!"YouTube WebM streams are currently not supported.".equals(lastException.getMessage())) {
// Rethrow certain FriendlyExceptions as suspicious to ensure LavaPlayer logs them.
throw new FriendlyException(lastException.getMessage(), Severity.SUSPICIOUS, lastException.getCause());
}

throw lastException;
}

throw ExceptionTools.toRuntimeException(lastException);
}
} catch (CannotBeLoaded e) {
throw ExceptionTools.wrapUnfriendlyExceptions("This video is unavailable", Severity.COMMON, e.getCause());
throw ExceptionTools.wrapUnfriendlyExceptions("This video is unavailable", Severity.SUSPICIOUS, e.getCause());
}
}

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

if (formats == null) {
throw new FriendlyException("This video cannot be played", Severity.COMMON, null);
throw new FriendlyException("This video cannot be played", Severity.SUSPICIOUS, null);
}

StreamFormat format = formats.getBestFormat();
Expand Down

0 comments on commit 5654235

Please sign in to comment.