-
Notifications
You must be signed in to change notification settings - Fork 133
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
Implement better error message for the v4 #1290
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
peaBerberian
force-pushed
the
misc/better-v4-error-message
branch
from
September 26, 2023 13:28
dd13009
to
2d72320
Compare
peaBerberian
force-pushed
the
next-v4
branch
from
September 26, 2023 14:12
69c4e93
to
1d2acdc
Compare
peaBerberian
force-pushed
the
misc/better-v4-error-message
branch
3 times, most recently
from
September 26, 2023 16:24
cfaf0fd
to
32d690e
Compare
peaBerberian
force-pushed
the
next-v4
branch
2 times, most recently
from
September 27, 2023 08:30
b5e1161
to
7c01cf7
Compare
Until now, the RxPlayer's errors set the Error's `name` property inside its `message` property. When logged in the console, such errors are automatically formatted by the browser which generally choose to re-use the `name` to produce a meaningful error string. This lead to a repeat like: `EncryptedMediaError: EncryptedMediaError (INCOMPATIBLE_KEYSYSTEMS) Some description message` This was unnecessary and kind of ugly but we were afraid some apps were for whatever reasons exploiting the `message` string and thus did not change it in the v3. For the `v4` we choose a more consize message: The code, followed by a colon, followed by a description of what happened. As such, the previous example would look like in a JS console when logged: `EncryptedMediaError: INCOMPATIBLE_KEYSYSTEMS: Some description message` If applications want to detect the error's name/type they can respectively rely on the more appropriate `name` or `type` property (basically the `name` is the PascalCased name here to have an idiomatic JS error, `type` is the RxPlayer's documented UPPER_SNAKE_CASE version of the name). Note that the error's message is still not part of the API and applications should still expect that it could theoretically change its format at any time, even if we're generally (too?) careful with that sort of things.
peaBerberian
force-pushed
the
misc/better-v4-error-message
branch
from
September 27, 2023 08:53
32d690e
to
8390ead
Compare
peaBerberian
added a commit
that referenced
this pull request
Sep 27, 2023
Implement better error message for the v4
peaBerberian
added a commit
that referenced
this pull request
Sep 29, 2023
Implement better error message for the v4
peaBerberian
added a commit
that referenced
this pull request
Oct 13, 2023
Implement better error message for the v4
peaBerberian
added a commit
that referenced
this pull request
Oct 13, 2023
Implement better error message for the v4
peaBerberian
added a commit
that referenced
this pull request
Oct 13, 2023
Implement better error message for the v4
peaBerberian
added a commit
that referenced
this pull request
Oct 19, 2023
Implement better error message for the v4
peaBerberian
added a commit
that referenced
this pull request
Oct 26, 2023
Implement better error message for the v4
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Until now, the RxPlayer's errors set the Error's
name
property inside itsmessage
property.When logged in the console, such errors are automatically formatted by the browser which generally choose to re-use the
name
to produce a meaningful error string.This lead to a repeat like:
EncryptedMediaError: EncryptedMediaError (INCOMPATIBLE_KEYSYSTEMS) Some description message
This was unnecessary and kind of ugly but we were afraid some apps were for whatever reasons exploiting the
message
string and thus did not change it in the v3.For the
v4
we choose a more consize message: The code, followed by a colon, followed by a description of what happened. As such, the previous example would look like in a JS console when logged:EncryptedMediaError: INCOMPATIBLE_KEYSYSTEMS: Some description message
If applications want to detect the error's name/type they can respectively rely on the more appropriate
name
ortype
property (basically thename
is the PascalCased name here to have an idiomatic JS error,type
is the RxPlayer's documented UPPER_SNAKE_CASE version of the name).Note that the error's message is still not part of the API and applications should still expect that it could theoretically change its format at any time, even if we're generally (too?) careful with that sort of things.