W3C home > Mailing lists > Public > public-device-apis-log@w3.org > October 2022

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

From: Marcos Cáceres via GitHub <sysbot+gh@w3.org>
Date: Mon, 03 Oct 2022 23:42:03 +0000
To: public-device-apis-log@w3.org
Message-ID: <issue_comment.created-1266207053-1664840521-sysbot+gh@w3.org>
> 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.


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

This archive was generated by hypermail 2.4.0 : Monday, 3 October 2022 23:42:06 UTC