-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
errors in PullTransfers are issued after end (or close) #464
Comments
I've just run into this too: This isn't correct node stream behaviour - you should either fire one or the other. Firing an It looks like this was introduced by this change: b4b8235 |
The leaked promise returned by readnext() in the b4b8235 change also causes the following warning, once per pull.
Clearly failed operations are not reported, and this can cause unhandled rejected promises :-(. |
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.
The text was updated successfully, but these errors were encountered: