Skip to content

Commit 292e103

Browse files
committed
Ignore ContentNotSupportedException caused by Bandcamp fan pages
1 parent 39a3f03 commit 292e103

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
import org.schabi.newpipe.error.UserAction;
6363
import org.schabi.newpipe.extractor.InfoItem;
6464
import org.schabi.newpipe.extractor.NewPipe;
65+
import org.schabi.newpipe.extractor.exceptions.ContentNotSupportedException;
6566
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
6667
import org.schabi.newpipe.extractor.stream.AudioStream;
6768
import org.schabi.newpipe.extractor.stream.Stream;
@@ -1547,8 +1548,19 @@ public void handleResult(@NonNull final StreamInfo info) {
15471548
}
15481549

15491550
if (!info.getErrors().isEmpty()) {
1550-
showSnackBarError(new ErrorInfo(info.getErrors(),
1551-
UserAction.REQUESTED_STREAM, info.getUrl(), info));
1551+
// Bandcamp fan pages are not yet supported and thus a ContentNotAvailableException is
1552+
// thrown. This is not an error and thus should not be shown to the user.
1553+
for (final Throwable throwable : info.getErrors()) {
1554+
if (throwable instanceof ContentNotSupportedException
1555+
&& "Fan pages are not supported".equals(throwable.getMessage())) {
1556+
info.getErrors().remove(throwable);
1557+
}
1558+
}
1559+
1560+
if (!info.getErrors().isEmpty()) {
1561+
showSnackBarError(new ErrorInfo(info.getErrors(),
1562+
UserAction.REQUESTED_STREAM, info.getUrl(), info));
1563+
}
15521564
}
15531565

15541566
binding.detailControlsDownload.setVisibility(info.getStreamType() == StreamType.LIVE_STREAM

0 commit comments

Comments
 (0)