Use exception utils in network error detection throughout the app

This commit is contained in:
Mauricio Colli 2020-03-28 20:10:48 -03:00
parent a1b9892c77
commit 913796ff0f
No known key found for this signature in database
GPG key ID: F200BFD6F29DDD85
6 changed files with 14 additions and 20 deletions

View file

@ -51,7 +51,6 @@ import org.schabi.newpipe.extractor.suggestion.SuggestionExtractor;
import org.schabi.newpipe.report.ErrorActivity;
import org.schabi.newpipe.report.UserAction;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
@ -288,7 +287,7 @@ public final class ExtractorHelper {
Intent intent = new Intent(context, ReCaptchaActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
} else if (exception instanceof IOException) {
} else if (ExceptionUtils.isNetworkRelated(exception)) {
Toast.makeText(context, R.string.network_error, Toast.LENGTH_LONG).show();
} else if (exception instanceof ContentNotAvailableException) {
Toast.makeText(context, R.string.content_not_available, Toast.LENGTH_LONG).show();