File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
extractor/src/main/java/org/schabi/newpipe/extractor
services/youtube/extractors Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change 3333import org .schabi .newpipe .extractor .services .youtube .YoutubeThrottlingDecrypter ;
3434import org .schabi .newpipe .extractor .services .youtube .linkHandler .YoutubeChannelLinkHandlerFactory ;
3535import org .schabi .newpipe .extractor .stream .*;
36+ import org .schabi .newpipe .extractor .utils .ExceptionUtils ;
3637import org .schabi .newpipe .extractor .utils .JsonUtils ;
3738import org .schabi .newpipe .extractor .utils .Parser ;
3839import org .schabi .newpipe .extractor .utils .Utils ;
@@ -799,8 +800,12 @@ public void onFetchPage(@Nonnull final Downloader downloader)
799800 nextFuture .get ();
800801 fetchAndroidFuture .get ();
801802 fetchDesktopSts .get ();
802- } catch (InterruptedException | ExecutionException e ) {
803- e .printStackTrace ();
803+ } catch (InterruptedException ignored ) {
804+ } catch (ExecutionException e ) {
805+ final Throwable cause = e .getCause ();
806+ if (cause != null ) {
807+ ExceptionUtils .rethrow (cause );
808+ }
804809 }
805810 }
806811
Original file line number Diff line number Diff line change 1+ package org .schabi .newpipe .extractor .utils ;
2+
3+ public class ExceptionUtils {
4+
5+ // From Apache Commons Lang: https://commons.apache.org/proper/commons-lang/javadocs/api-3.10/org/apache/commons/lang3/exception/ExceptionUtils.html#rethrow-java.lang.Throwable-
6+
7+ public static <R > R rethrow (final Throwable throwable ) {
8+ // claim that the typeErasure invocation throws a RuntimeException
9+ return ExceptionUtils .<R , RuntimeException >typeErasure (throwable );
10+ }
11+
12+ @ SuppressWarnings ("unchecked" )
13+ private static <R , T extends Throwable > R typeErasure (final Throwable throwable ) throws T {
14+ throw (T ) throwable ;
15+ }
16+ }
You can’t perform that action at this time.
0 commit comments