|
58 | 58 | import org.schabi.newpipe.extractor.StreamingService; |
59 | 59 | import org.schabi.newpipe.extractor.StreamingService.LinkType; |
60 | 60 | import org.schabi.newpipe.extractor.channel.ChannelInfo; |
61 | | -import org.schabi.newpipe.extractor.exceptions.AgeRestrictedContentException; |
62 | 61 | import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException; |
63 | 62 | import org.schabi.newpipe.extractor.exceptions.ContentNotSupportedException; |
64 | 63 | import org.schabi.newpipe.extractor.exceptions.ExtractionException; |
65 | | -import org.schabi.newpipe.extractor.exceptions.GeographicRestrictionException; |
66 | | -import org.schabi.newpipe.extractor.exceptions.PaidContentException; |
67 | | -import org.schabi.newpipe.extractor.exceptions.PrivateContentException; |
68 | 64 | import org.schabi.newpipe.extractor.exceptions.ReCaptchaException; |
69 | | -import org.schabi.newpipe.extractor.exceptions.SoundCloudGoPlusContentException; |
70 | | -import org.schabi.newpipe.extractor.exceptions.YoutubeMusicPremiumContentException; |
71 | 65 | import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler; |
72 | 66 | import org.schabi.newpipe.extractor.playlist.PlaylistInfo; |
73 | 67 | import org.schabi.newpipe.extractor.stream.StreamInfo; |
74 | | -import org.schabi.newpipe.ktx.ExceptionUtils; |
75 | 68 | import org.schabi.newpipe.local.dialog.PlaylistDialog; |
76 | 69 | import org.schabi.newpipe.player.PlayerType; |
77 | 70 | import org.schabi.newpipe.player.helper.PlayerHelper; |
@@ -279,28 +272,11 @@ private static void handleError(final Context context, final ErrorInfo errorInfo |
279 | 272 | final Intent intent = new Intent(context, ReCaptchaActivity.class); |
280 | 273 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
281 | 274 | context.startActivity(intent); |
282 | | - } else if (errorInfo.getThrowable() != null |
283 | | - && ExceptionUtils.isNetworkRelated(errorInfo.getThrowable())) { |
284 | | - Toast.makeText(context, R.string.network_error, Toast.LENGTH_LONG).show(); |
285 | | - } else if (errorInfo.getThrowable() instanceof AgeRestrictedContentException) { |
286 | | - Toast.makeText(context, R.string.restricted_video_no_stream, |
287 | | - Toast.LENGTH_LONG).show(); |
288 | | - } else if (errorInfo.getThrowable() instanceof GeographicRestrictionException) { |
289 | | - Toast.makeText(context, R.string.georestricted_content, Toast.LENGTH_LONG).show(); |
290 | | - } else if (errorInfo.getThrowable() instanceof PaidContentException) { |
291 | | - Toast.makeText(context, R.string.paid_content, Toast.LENGTH_LONG).show(); |
292 | | - } else if (errorInfo.getThrowable() instanceof PrivateContentException) { |
293 | | - Toast.makeText(context, R.string.private_content, Toast.LENGTH_LONG).show(); |
294 | | - } else if (errorInfo.getThrowable() instanceof SoundCloudGoPlusContentException) { |
295 | | - Toast.makeText(context, R.string.soundcloud_go_plus_content, |
296 | | - Toast.LENGTH_LONG).show(); |
297 | | - } else if (errorInfo.getThrowable() instanceof YoutubeMusicPremiumContentException) { |
298 | | - Toast.makeText(context, R.string.youtube_music_premium_content, |
299 | | - Toast.LENGTH_LONG).show(); |
300 | | - } else if (errorInfo.getThrowable() instanceof ContentNotAvailableException) { |
301 | | - Toast.makeText(context, R.string.content_not_available, Toast.LENGTH_LONG).show(); |
302 | | - } else if (errorInfo.getThrowable() instanceof ContentNotSupportedException) { |
303 | | - Toast.makeText(context, R.string.content_not_supported, Toast.LENGTH_LONG).show(); |
| 275 | + } else if (errorInfo.getThrowable() instanceof ContentNotAvailableException |
| 276 | + || errorInfo.getThrowable() instanceof ContentNotSupportedException) { |
| 277 | + // this exception does not usually indicate a problem that should be reported, |
| 278 | + // so just show a toast instead of the notification |
| 279 | + Toast.makeText(context, errorInfo.getMessage(context), Toast.LENGTH_LONG).show(); |
304 | 280 | } else { |
305 | 281 | ErrorUtil.createNotification(context, errorInfo); |
306 | 282 | } |
|
0 commit comments