Skip to content

Add more specific error messages and deduplicate their handling#12578

Merged
Stypox merged 7 commits intoTeamNewPipe:devfrom
Stypox:better-error-messages
Sep 4, 2025
Merged

Add more specific error messages and deduplicate their handling#12578
Stypox merged 7 commits intoTeamNewPipe:devfrom
Stypox:better-error-messages

Conversation

@Stypox
Copy link
Member

@Stypox Stypox commented Aug 28, 2025

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

GitHub closed #12477 and I can't reopen it, hence a new PR.

This PR deduplicates the decision of which error message to show for which throwable (it was done in 3 different places previously). It also adds some nice new error messages for specific errors, so users understand better what is going on (and maybe complain less when YouTube breaks something ;-) ).

  • In RouterActivity, a toast is shown like before if the error is not something that usually needs to be reported, as to not distract the user with a notification.
  • Make error snackbar display the actual error that has occurred, instead of showing "Sorry, something went wrong" every time. For example, "Could not parse website" is much more explanatory as the snackbar description when some item in a list can not be extracted (this is already shown in the error panel).
  • All subclasses of ContentNotAvailableException now have nice specific error messages, and in particular this PR adds UnsupportedContentInCountryException (from [YouTube] Add support for more kiosks and change default one NewPipeExtractor#1354) and SignInConfirmNotBotException ( [YouTube] Add custom error for "Sign in to confirm ..." NewPipeExtractor#1352). The latter in particular will hopefully help reduce the amount of duplicate comments in [YouTube] "Sign in to confirm..."/"Watch on the latest version..." #11139.
  • Various player-related exceptions are now inspected to extract the original cause and show that to the user instead of always saying "Could not play this stream". In particular, 403 errors are detected and a custom error message is shown for them: "HTTP error 403 occurred while playing, likely caused by an IP ban or streaming URL deobfuscation issues" (this message was inspired by FreeTube's). This should also help reduce the amount of duplicates we get related to 403 errors.

Relies on the following changes

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR. You can find more info and a video demonstration on this wiki page.

Due diligence

@github-actions github-actions bot added the size/medium PRs with less than 250 changed lines label Aug 28, 2025
@Stypox Stypox added this to v0.28.x Aug 28, 2025
@github-project-automation github-project-automation bot moved this to Todo in v0.28.x Aug 28, 2025
@Stypox Stypox moved this from Todo to In Progress in v0.28.x Aug 28, 2025
@Stypox Stypox added bug Issue is related to a bug feature request Issue is related to a feature in the app labels Aug 28, 2025
@Stypox Stypox force-pushed the better-error-messages branch from 4cb62bf to 1bde2dc Compare August 28, 2025 15:06
Copy link
Contributor

@TobiGr TobiGr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Stypox added 2 commits August 30, 2025 14:36
- ErrorInfo.getMessage() now returns an ErrorMessage instance that can be formatted into a string using a context (this allows the construction of an ErrorInfo to remain independent of a Context)
- now the service ID is used in ErrorInfo.getMessage() to customize some messages based on the currently selected service
- player HTTP invalid statuses are now included in the message
- building a custom error message for AccountTerminatedException was moved from ErrorPanelHelper to ErrorInfo
@github-actions github-actions bot added size/large PRs with less than 750 changed lines and removed size/medium PRs with less than 250 changed lines labels Aug 30, 2025
@Stypox
Copy link
Member Author

Stypox commented Aug 30, 2025

This is how "This account is terminated" looks:

Before After
Before After

I know that now it kinda looks less nice, but now the control over the error is given fully to ErrorInfo, instead of having ErrorPanelHelper change the error message in a hardcoded way only for AccountTerminatedException.

@HeroponRikiBestest
Copy link

HeroponRikiBestest commented Aug 30, 2025

Regarding #12533 ;

Thanks for testing everyone! Now development has moved to #12578, it would be cool if you could test the APK from there and report here again :-)

So, in the event that I start getting served "sign in to confirm" from YouTube, I should test this APK and report what it gives me? Or is no further testing needed unless something goes wrong with newpipe's error reporting

@Stypox
Copy link
Member Author

Stypox commented Aug 30, 2025

So, in the event that I start getting served "sign in to confirm" from YouTube, I should test this APK and report what it gives me?

@HeroponRikiBestest yes, thanks in advance :-)

@HeroponRikiBestest
Copy link

HeroponRikiBestest commented Sep 1, 2025

So, in the event that I start getting served "sign in to confirm" from YouTube, I should test this APK and report what it gives me?

@HeroponRikiBestest yes, thanks in advance :-)

Screenshot_20250901_010507_NewPipe better-error-messages

Tested with the latest CI build of this PR, this is what it reports when it occurs; seems correct to me.

GETTING_MAIN_SCREEN_TAB("getting main screen tab");
GETTING_MAIN_SCREEN_TAB("getting main screen tab"),
PLAY_ON_POPUP("play on popup"),
SUBSCRIPTIONS("loading subscriptions"),;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SUBSCRIPTIONS("loading subscriptions"),;
SUBSCRIPTIONS("loading subscriptions");

<string name="trending_movies">Trending movies and shows</string>
<string name="trending_music">Trending music</string>
<string name="entry_deleted">Entry deleted</string>
<string name="player_http_403">HTTP error 403 received from server while playing, likely caused by an IP ban or by streaming URL expiration</string>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<string name="player_http_403">HTTP error 403 received from server while playing, likely caused by an IP ban or by streaming URL expiration</string>
<string name="player_http_403">HTTP error 403 received from server while playing, likely caused by streaming URL expiration or an IP ban</string>

@Stypox Stypox merged commit a3ddd61 into TeamNewPipe:dev Sep 4, 2025
5 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in v0.28.x Sep 4, 2025
@TobiGr TobiGr mentioned this pull request Dec 21, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue is related to a bug feature request Issue is related to a feature in the app size/large PRs with less than 750 changed lines

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants