Include errors from child collectors in the search collector

This commit is contained in:
Mauricio Colli 2020-03-21 02:21:23 -03:00
parent 2cf8cbf0df
commit 0c27198ba1
No known key found for this signature in database
GPG Key ID: F200BFD6F29DDD85
1 changed files with 22 additions and 0 deletions

View File

@ -11,6 +11,10 @@ import org.schabi.newpipe.extractor.playlist.PlaylistInfoItemsCollector;
import org.schabi.newpipe.extractor.stream.StreamInfoItemExtractor; import org.schabi.newpipe.extractor.stream.StreamInfoItemExtractor;
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector; import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/* /*
* Created by Christian Schabesberger on 12.02.17. * Created by Christian Schabesberger on 12.02.17.
* *
@ -55,6 +59,24 @@ public class InfoItemsSearchCollector extends InfoItemsCollector<InfoItem, InfoI
playlistCollector = new PlaylistInfoItemsCollector(serviceId); playlistCollector = new PlaylistInfoItemsCollector(serviceId);
} }
@Override
public List<Throwable> getErrors() {
final List<Throwable> errors = new ArrayList<>(super.getErrors());
errors.addAll(streamCollector.getErrors());
errors.addAll(userCollector.getErrors());
errors.addAll(playlistCollector.getErrors());
return Collections.unmodifiableList(errors);
}
@Override
public void reset() {
super.reset();
streamCollector.reset();
userCollector.reset();
playlistCollector.reset();
}
@Override @Override
public InfoItem extract(InfoItemExtractor extractor) throws ParsingException { public InfoItem extract(InfoItemExtractor extractor) throws ParsingException {
// Use the corresponding collector for each item extractor type // Use the corresponding collector for each item extractor type