Skip to content

separate errors between public_api and internal#1797

Open
peaBerberian wants to merge 1 commit intodevfrom
errors-internal-api
Open

separate errors between public_api and internal#1797
peaBerberian wants to merge 1 commit intodevfrom
errors-internal-api

Conversation

@peaBerberian
Copy link
Copy Markdown
Collaborator

Step toward better resilience

We recently worked on resilience in an application, where, on various decoding issues, we would reload a content without playing the media quality that we suspect had triggered the issue.

It was a big success, in the sense that decoding errors reported in production fell dramatically.

We did that work directly in that application's code because it was less risky to do our Proof-of-concept directly in the project seeing the issue than more globally in the RxPlayer.

But now that it is a success, we begin investigating doing that work inside the RxPlayer.

There's multiple ways of doing it, but most of the clean solutions I'm thinking of imply Error instances communicating more information than what they do today (e.g. indicate with a BUFFER_APPEND_ERROR which segment provoked the issue).

Issue with the current Errors

The more straightforward would be updating e.g. the properties from an RxPlayer's MediaError error in cases of decoding issues but adding properties to it would mean updating our API (even if it would be undocumented, the presence of supplementary properties could led application developers to rely on them).

Updating our API comes with stability guarantees and thus I don't want to do that.

Instead, I'll more probably rely on another "internal" error (errors only intended to be used inside the RxPlayer), just like we already do with CustomLoadedError (errors linked to a manifestLoader / segmentLoader) a SourceBufferError (error linked to a SourceBuffer operation) or a RequestError (error linked to an HTTP request specifically - unlike the more generic NetworkError).

But I found out that distinguing the two (internal and API errors) was unclear in the codebase, they both were exported from the same path, and you could see the distinction only by reading around.

What I propose here

I'm here clearly marking a separation between API errors - which now have to be imported from the errors/public_api path explicitly and internal errors, imported from errors/internal. Likewise the vague isKnownError has been renamed to isApiError. This more clearly indicates that the two are different.

This opens the way to easily declare and use more external errors, which I think can be a good thing to facilitate resilience developments.

@peaBerberian peaBerberian force-pushed the errors-internal-api branch 6 times, most recently from ce3567c to aff16da Compare February 10, 2026 17:24
@peaBerberian peaBerberian force-pushed the errors-internal-api branch 3 times, most recently from 4d36a4d to b9b7c04 Compare February 27, 2026 16:06
@canalplus canalplus deleted a comment from github-actions bot Feb 27, 2026
@canalplus canalplus deleted a comment from github-actions bot Feb 27, 2026
@github-actions
Copy link
Copy Markdown

✅ Automated performance checks have passed on commit ea2f5d1e300dba7b3b632071b594d495b55650b2 with the base branch dev.

Details

Performance tests 1st run output

No significative change in performance for tests:

Name Mean Median
loading 25.34ms -> 26.03ms (-0.694ms, z: 0.35403) 35.70ms -> 35.70ms
seeking 278.93ms -> 274.96ms (3.961ms, z: 0.03225) 17.75ms -> 18.00ms
audio-track-reload 31.99ms -> 31.81ms (0.187ms, z: 1.27273) 47.15ms -> 47.10ms
cold loading multithread 51.49ms -> 50.83ms (0.661ms, z: 10.49101) 76.20ms -> 75.15ms
seeking multithread 137.61ms -> 124.27ms (13.333ms, z: 0.78367) 19.65ms -> 19.65ms
audio-track-reload multithread 30.18ms -> 30.10ms (0.081ms, z: 1.26706) 44.25ms -> 44.10ms
hot loading multithread 20.59ms -> 21.12ms (-0.532ms, z: 2.26858) 30.15ms -> 30.00ms

@canalplus canalplus deleted a comment from github-actions bot Mar 24, 2026
@peaBerberian peaBerberian added the Priority: 2 (Medium) This issue or PR has a medium priority. label Apr 2, 2026
@peaBerberian peaBerberian force-pushed the errors-internal-api branch 2 times, most recently from ea71745 to 12ef01a Compare April 9, 2026 17:59
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

✅ Automated performance checks have passed on commit be4cd954dc6ace8b2ee832dab9474d1d7cbeea91 with the base branch dev.

Details

Performance tests 1st run output

No significative change in performance for tests:

Name Mean Median
loading 24.31ms -> 23.98ms (0.322ms, z: 1.08975) 33.60ms -> 33.75ms
seeking 293.29ms -> 282.67ms (10.619ms, z: 0.42207) 17.40ms -> 17.40ms
audio-track-reload 30.89ms -> 31.00ms (-0.115ms, z: 0.99762) 45.90ms -> 46.05ms
cold loading multithread 49.79ms -> 51.06ms (-1.271ms, z: 12.35311) 73.65ms -> 72.75ms
seeking multithread 164.86ms -> 147.59ms (17.263ms, z: 0.05763) 18.60ms -> 18.75ms
audio-track-reload multithread 30.33ms -> 30.31ms (0.022ms, z: 0.13416) 44.55ms -> 44.40ms
hot loading multithread 20.00ms -> 19.90ms (0.102ms, z: 2.04430) 29.25ms -> 29.10ms

Step toward better resilience
------------------------------

We recently worked on resilience in an application, where, on various
decoding issues, we would reload a content without playing the media
quality that we suspect had triggered the issue.

It was a big success, in the sense that decoding errors reported in
production fell dramatically.

Now we did that work directly in that application's code because it was
less risky to do our Proof-of-concept directly in the code of the
project seeing the issue than more globally in the RxPlayer.

But now that it is a success, and now that we also suspect similar
behavior from other players, we begin investigating doing that work
inside the RxPlayer.

There's multiple ways of doing it, but most of the clean solutions I'm
thinking of imply `Error` instances communicating more information than
what they do today.

Issue with the current `Error`s
-------------------------------

The more straightforward would be updating e.g. the properties from an
RxPlayer's `MediaError` error in cases of decoding issues (e.g. to
indicate which segment provoked the issue) but adding properties to it
would mean updating our API.

Updating our API comes with stability guarantees and I don't want to do
that.

Instead, I'll more probably on another "internal" error (errors only
intended to be used inside the RxPlayer), like `CustomLoadedError`
(errors linked to a `manifestLoader` / `segmentLoader`) a
`SourceBufferError` (error linked to a `SourceBuffer` operation) or a
`RequestError` (error linked to an HTTP request specifically - unlike
the more generic `NetworkError`).

But I found out that distinguing the two (internal and API errors) was
unclear, they both were exported from the same path, and you could see
the distinction only by reading around.

What I propose here
-------------------

I'm here clearly marking a separation between API errors - which now
have to be imported from the `errors/public_api` path explicitly and
internal errors, imported from `errors/internal`. Likewise the vague
`isKnownError` has been renamed to `isApiError`. This more clearly
indicates that the two are different.

This opens the way to easily declare and use more external errors, which
I think can be a good thing to facilitate resilience developments.
@peaBerberian peaBerberian force-pushed the errors-internal-api branch from 12ef01a to 5a5b19d Compare April 9, 2026 19:03
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

✅ Automated performance checks have passed on commit b590d70be313166c7050c7c46ddcba57327c1d8a with the base branch dev.

Details

Performance tests 1st run output

No significative change in performance for tests:

Name Mean Median
loading 24.89ms -> 24.94ms (-0.046ms, z: 0.01811) 35.10ms -> 35.10ms
seeking 250.76ms -> 261.44ms (-10.677ms, z: 0.70511) 17.55ms -> 17.70ms
audio-track-reload 31.51ms -> 31.67ms (-0.156ms, z: 0.20804) 46.50ms -> 46.50ms
cold loading multithread 52.86ms -> 51.38ms (1.480ms, z: 9.47809) 76.95ms -> 75.90ms
seeking multithread 207.50ms -> 199.60ms (7.903ms, z: 0.17404) 19.20ms -> 19.20ms
audio-track-reload multithread 31.12ms -> 31.04ms (0.076ms, z: 0.60223) 45.45ms -> 45.30ms
hot loading multithread 21.64ms -> 21.51ms (0.135ms, z: 1.79197) 31.50ms -> 31.20ms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: 2 (Medium) This issue or PR has a medium priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant