When I close a websocket, the exception is not pro...
# ktor
c
When I close a websocket, the exception is not propagated over the channel, when I call receive() on one side, and the channel was closed with close(e) on the other side, It doesn't trace the cause, receive() just throws ClosedReceiveChannelException, not the cause of it happened on the other side
d
What you mean is that the
ClosedReceiveChannelException
is thrown, but the message property is not set with the message from the exception you used for closing it on the other side?
c
yes indeed the reason seems to be set properly, but on the other side when I call receive(), all I get is just a normal
ClosedReceiveChannelException
strange
of course this happens during tests and I am using withTestApplication along with handleWebSocketConversation to test my websocket server
if there is an exception all I do is to close the websocket passing that exception as parameter, which in my case happened to be IllegalArgumentException
but on the other side it's not reported
all i get is: kotlinx.coroutines.experimental.channels.ClosedReceiveChannelException: Channel was closed
d
and ClosedReceiveChannelException.message is not populated with the right message?
@e5l is this the expected behaviour?
c
exactly, all I see in message is the standard: "Channel was closed"
while it should report the message of my illegal argument exception
which is another one of course
d
Can you report it as an issue here: https://github.com/ktorio/ktor/issues ? With ktor version, and showing the code where you do the close, and the code with the receive. That will help to address it earlier
c
ok
đŸ‘Œ 2
done
d
you catch a throwable, but that throwable is a ClosedReceiveChannelException? if that’s the case, the message is not stored
that information would help too
e
Looks like a bug, thanks for the report