Skip to content

errors in PullTransfers are issued after end (or close) #464

@dfriederich

Description

@dfriederich

When trying to use the PullTransfer returned by a DeviceClient.pull, I did not find a way to reliably report errors.
The issue is that while errors are reported, all the reliably sent events in the PullTransfer class are executed first.
Hence there is no way to for example fail a result promise reliably, as there is no event which I can wait for.
The attached test code results in this output:

`d.friederich@xdfriederich:.../src/adbkit$node ./dist/src/pull_error_order.js
pull_simple_async: /data/local/tmp/file_which_does_not_exist
event: stream resume
event: stream prefinish
event: stream end
event: stream finish
event: stream close
pull done

event: stream error
error argument: FailError: Failure: 'open failed: No such file or directory'
sleep done
pull_error_order.zip

pull_async: /data/local/tmp/file_which_does_not_exist
event: stream resume
event: stream prefinish
event: stream end
event: stream finish
event: stream close
pull done

event: stream error
error argument: FailError: Failure: 'open failed: No such file or directory'
`
Or in other words, the optional error event is sent after the end, finish and close events. Hence there is no event I can wait for reliably.
Is there an event or some other way to know that the operation is done and no error can happen anymore? I looked but did not find anything. I think the current order of events is incorrect, the error has to occur before some other event to make it usable if we need to associate the error with a specific pull operation.

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