Re: [screen-wake-lock] Distinguish exceptions on .request() (#352)

> I don't think we need to distinguish between not fully-active and not visible. `InvalidStateError` seems reasonable for both

Yeah, I'd be ok with that.

> though the current NotAllowedError also seems reasonable.  

The definition of NotAllowedError is so large in scope that it could indeed apply. However, I personally tend to reserve `NotAllowedError` for when the user doesn't allow something. 

> The question I ask myself when thinking about this sort of thing is whether there is a different action the developer would take depending on the error.

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). 

>  Using InvalidStateError for transient failures and NotAllowedError for permanent ones seems like a reasonably clear distinction. A developer could try again in the former case while giving up and taking a different approach in the latter.

Agree. 






-- 
GitHub Notification of comment by marcoscaceres
Please view or discuss this issue at https://github.com/w3c/screen-wake-lock/issues/352#issuecomment-1266207053 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 3 October 2022 23:42:05 UTC