braverhealth / phoenix-socket-dart

Cross-platform and stream-based implementation of Phoenix Sockets
https://pub.dev/packages/phoenix_socket
BSD 3-Clause "New" or "Revised" License
73 stars 37 forks source link

Exceptions/errors other than PhoenixException get swallowed when a Push fails #68

Closed miguelcmedeiros closed 6 months ago

miguelcmedeiros commented 6 months ago

In the event of _channel.socket.sendMessage() (in Push.send()) or _channel.onPushReply() throwing, then the exception/error is swallowed in _receiveResponse() since it handles on Message and PhoenixException.

If there another failure, then those are not handled internally by the package or neither do they bubble up to the caller side.

opsb commented 6 months ago

This one bit me today, I was sending a message with {"id": UUID()} and hadn't realised that it should have been {"id": UUID().v4()}. There was no error and I even got a reply of OK.

edit: just tried running my scenario against this fix, the error showed up immediately. This change would have saved me hours today.

Pacane commented 6 months ago

cc @matehat @phildupuis