Re: [web-nfc] Avoid creating custom errors (#391)

In the Generic Sensors API the [`SensorErrorEvent`](https://w3c.github.io/sensors/#the-sensor-error-event-interface) is used to indicate that an error occurred while the sensor was active. The intuition is that a sensor can be initialized successfully and begin producing readings but then encounter and error (such as disconnection) and there needs to be a mechanism to report that. As the sensor has already been started successfully the Promise returned by the `start()` method has already settled, so an additional mechanism is needed.

In this specification I don't see `NFCErrorEvent` being thrown in any circumstance other than in the steps to initialize a scan. It is reasonable in that case to remove the event and have `scan()` return a Promise that is rejected instead. If, however, we want to report later error conditions we will need to have an event, just like in Generic Sensors.

I wonder if this concept is reusable to the point that the TAG would recommend standardizing a `DOMExceptionEvent` or `ErrorEvent` that could be reused across specifications for this purpose.

-- 
GitHub Notification of comment by reillyeon
Please view or discuss this issue at https://github.com/w3c/web-nfc/issues/391#issuecomment-543843645 using your GitHub account

Received on Friday, 18 October 2019 17:17:05 UTC