In a polling design, transferIn is continuously called to receive incoming data. But if the device disconnects, transferIn step 14 only throws a generic NetworkError. Plus, the disconnect event is fired after the error was thrown (at least on Windows and Chrome), it's impossible to detect the reason of such NetworkError.
Device disconnection is usually handled differently from other transfer errors (it's initiated by the user, not a logic error), "check if the device is configured" algorithm throws a NotFoundError if the device is not connected anymore, shows that there are at least some considerations for this situation.
Suggests:
- Also throws
NotFoundError in transferIn step 14 if the failure reason is device disconnection.
- Precisely define the order of
disconnect event, device.open property value change, and transferIn throwing, when a device disconencts.