-
Notifications
You must be signed in to change notification settings - Fork 165
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
Bikeshedding help needed for generic over-limit error #1463
Comments
New custom error types like this tend to be difficult to implement in practice. I'd almost prefer for DOMException to allow for an arbitrary If not that, something like LimitExceededError might work? |
New custom error types are not difficult for the web, at least. Whereas arbitrary properties are much more difficult, especially given issues around getters that return dictionaries. Anyway, can you say more about your preference for the |
Given that QuotaExceededError is already used for "requested too many bytes" in crypto (sidebar: why do we have this limit) and "requested too many recognizers" in the Handwriting Recognition API, I think it's already been generalized beyond just storage, so it seems fine to continue using it for other kinds of quota. Does it actually need to be a new type? Is there a reason not to just add more properties to the existing QuotaExceededError type? The usual thing in JS would be to have optional properties for when additional data is available (like how errors now all have an optional |
@bakkot ... Good point on QuotaExceeded already being used in other contexts. Given that I think I can live with it. @domenic ... My preference for LimitExceeded is really just subjective. I just happen to like that shade of paint for the bike shed. But again, given a choice it would be a shame to have to introduce a whole new error type. |
The problem is that So if we want to add properties, our options are:
(2) and (3) require custom bindings, which web browser implementations are generally loathe to do. So we created the (1) path, with first-class support in the spec, since it seemed like the best we could do, and it paved a cowpath that at least two specs were already following. If implementers think (2) is reasonable, maybe we could do that instead. I agree that not having two different types of "quota exceeded error"s in the platform is valuable. I've pinged our Blink bindings expert, @natechapin, to get his take on how disruptive it would be to implement (2). |
Ah, I'd forgotten that's how it works. No, I wouldn't be in favor of conditionally adding properties to base What about doing (1), but calling it |
It's a good point that It might be a slightly hard sell to take on compat risk, but maybe it's worth trying. |
It doesn't look like very many people are checking the |
What is the issue with the Web IDL Standard?
In webmachinelearning/writing-assistance-apis#31 I proposed adding a
TooManyTokens
DOMException
-derived interface which gives information on how far over the token limit you are. It had propertiestokenCount
andtokensAvailable
, such thatex.tokenCount > ex.tokenAvailable
is the error condition being signaled.@michaelwasserman pointed out that this would probably be worth generalizing beyond "tokens", for the entire web ecosystem to use. I tend to agree. I'm just unsure what the general names should be.
My current best proposal is:
QuotaExceededDetailedError
, with propertiesquota
andrequest
. This plays off of the existing, non-detailed"QuotaExceededError"
DOMException
.(But, maybe "quota" feels too storage-specific? Check out
"QuotaExceededError"
DOMException
's existing usages on the web to see what you think.)Other options:
LimitExceededError
,LimitError
,OverageError
requested
(instead ofrequest
),limit
,max
,available
amount
,value
,attempted
Does the community have any thoughts on what would be the best names, which are suitable for the web API ecosystem as a whole?
The text was updated successfully, but these errors were encountered: