-
Notifications
You must be signed in to change notification settings - Fork 35
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
Distinguish exceptions on .request() #352
Comments
This seems reasonable. Are there other examples where |
I'm a bit bias, as I edited the following, but web share's Searching webkit's code base, |
For visibility state hidden rejections, perhaps we should use That covers all the cases, I think. |
I don't think we need to distinguish between not fully-active and not visible. |
Yeah, I'd be ok with that.
The definition of NotAllowedError is so large in scope that it could indeed apply. However, I personally tend to reserve
I'm approaching it more from "why did it fail?" instead of what action can one take (i.e., taking some of the guess work out of it, otherwise it could have failed for any reason in the spec).
Agree. |
That's what the message is for. If we are explaining the error to the developer then we have as many words as we want to do that. What I want to avoid is developers running regular expressions over the message string to figure out what step to take next. That's where having well-considered use of the DOMException types is important. |
Ideally want to avoid that, as the message allows for further UA identification (why I asked in the OP "without relying on error messages").
Exactly. |
I would like to see some documentation of this threat model before considering it in the design of specifications. I would consider exception messages to be equivalent to the browser engine major version, which is already available to script. If there is concern about leaking sensitive information to script then I know Blink has a mechanism for providing sanitized and unsanitized error messages, the latter only being available on the Javascript console and not to script. I suspect this feature was inherited from WebKit. |
It's complicated, but see:
No, it's not really about that... it's just about reducing differences between browsers (and also for i18n reasons, as described in the links). |
I don't see consensus on a resolution to that issue however I'm okay with Anne's recommendation to standardize the message value to reduce differences between browsers. Since you've proposed removing the permission every reason for the API to reject is some kind of developer error and would never be presented to the user. How about we keep using |
That still feels kinda not right to me. My preference would be to use the exception types, as there is plenty of precedence (#352 (comment)) at least for |
Ping on this one too! Could the Editors please address this bug. |
@rakuco, please take a look at the suggestions here and propose a specification change to align the behavior between implementations. |
I'm not happy with specifying error messages here. If we want to distinguish various error cases, different exception types should be used. So, I agree with #352 (comment) |
Change agreed on at TPAC 2024:
|
I'm wondering if we should distinguish a few exceptions it more obvious why things failed? (without relying on error messages).
For instance, in request(), when document is null or not fully active or hidden, maybe an
InvalidStateError
might be good there?The text was updated successfully, but these errors were encountered: