Skip to content

Can't detect device disconnection when transferIn is waiting incoming data #219

Open
@yume-chan

Description

@yume-chan

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:

  1. Also throws NotFoundError in transferIn step 14 if the failure reason is device disconnection.
  2. Precisely define the order of disconnect event, device.open property value change, and transferIn throwing, when a device disconencts.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions