-
Notifications
You must be signed in to change notification settings - Fork 74
Description
Hello,
I've run into a situation where a request never completes. The context is with requests sent from within a browser: CORS comes into play, so a response never comes through when the target server does not support CORS (I guess the fetch operation fails too early in the pipeline).
I've managed to trace it down to the Peer
class which has forwarders for the server and the client. As it happens, the error does come through in the onError
callback installed in _channel.stream.listen()
. However, that callback only forwards errors to the _serverIncomingForwarder
. In fact, _clientIncomingForwarder.addError
is never called so no error can ever be notified via that channel.
tools/pkgs/json_rpc_2/lib/src/peer.dart
Lines 162 to 164 in a0af8b5
}, onError: (Object error, StackTrace stackTrace) { | |
_serverIncomingForwarder.addError(error, stackTrace); | |
}, onDone: close); |
FYI I modified my local copy so that the error gets forwarded to both the server and the client, and it fixed the issue.
I don't know if it's the right way to go as I'm not sure whether errors should be dispatched to the client or the server only and on what condition, so I'll let you look at it!