if an ErrorMessage can be obtained, throw ContentNotAvailableException with ErrorMessage as text

This commit is contained in:
Robin 2020-01-08 15:06:33 +01:00
parent 8aa0f1f174
commit 244cf52fe6
1 changed files with 3 additions and 8 deletions

View File

@ -4,6 +4,7 @@ import org.schabi.newpipe.extractor.ListExtractor.InfoItemsPage;
import org.schabi.newpipe.extractor.ListInfo;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
@ -65,17 +66,11 @@ public class ChannelInfo extends ListInfo<StreamInfoItem> {
info = new ChannelInfo(extractor.getServiceId(),
extractor.getLinkHandler(),
"");
Throwable nameFailure;
String errorMessage = extractor.obtainErrorMessage();
if (errorMessage != null) {
nameFailure = new ParsingException(errorMessage);
} else {
nameFailure = e;
throw new ContentNotAvailableException(errorMessage);
}
info.addError(nameFailure);
// this is so severe, that other extractions most likely fail anyway,
// so skip them
return info;
info.addError(e);
}
try {