Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add localized error message. #250

Merged
merged 9 commits into from
Sep 25, 2023
Merged

Conversation

StaehliJ
Copy link
Contributor

@StaehliJ StaehliJ commented Sep 20, 2023

Pull request

Description

Add localized block reason error message. Make also core business exceptions usable with Media3 and especially when using MediaController or MediaBrowser.

Changes made

  • SRGErrorMessageProvider provide localized error messages.
  • Change some core business exception to allow them to be serialized and deserialized by Media3.
  • Integration layer http errors are currently not localized.

Checklist

  • Your branch has been rebased onto the main branch.
  • APIs have been properly documented (if relevant).
  • The documentation has been updated (if relevant).
  • New unit tests have been written (if relevant).
  • The demo has been updated (if relevant).
  • All pull request status checks pass.

@StaehliJ StaehliJ linked an issue Sep 20, 2023 that may be closed by this pull request
3 tasks

override fun getErrorMessage(throwable: PlaybackException): Pair<Int, String> {
return when (val cause = throwable.cause) {
is BlockReasonException -> {
Pair.create(0, cause.blockReason.name)
val message = context.resources.getStringArray(R.array.blockReasonArray)[cause.blockReason.ordinal]
Copy link
Member

@defagos defagos Sep 22, 2023

Choose a reason for hiding this comment

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

Fragile but you still decided to keep it anyway?

@StaehliJ StaehliJ force-pushed the 249-improve-error-with-localized-message branch from 865d370 to fbd7f26 Compare September 22, 2023 06:38
Http error are currently not localized.
Throwable error are serialized by Media3 and need to have a constructor(message:String) in order to recreated the error.
The error is not the one we were testing. Uri always null because it can't be created here.
@StaehliJ StaehliJ force-pushed the 249-improve-error-with-localized-message branch from 607c07d to e5c8596 Compare September 25, 2023 06:53
@StaehliJ StaehliJ requested a review from defagos September 25, 2023 08:48
@StaehliJ StaehliJ merged commit f2ef278 into main Sep 25, 2023
4 checks passed
@StaehliJ StaehliJ deleted the 249-improve-error-with-localized-message branch September 25, 2023 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve error with localized message
2 participants