From e3a1b9ed418eddc36eba7fca1d7d84c8b5a81ce0 Mon Sep 17 00:00:00 2001 From: aikrikunov95 Date: Tue, 19 Jan 2021 15:03:08 +0300 Subject: [PATCH] Stop inputMessage() from error when user quits --- .../05_creating_the_chat_client.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Creating a WebSocket Chat with Ktor/05_creating_the_chat_client.md b/Creating a WebSocket Chat with Ktor/05_creating_the_chat_client.md index 3a9ca0a..b984f76 100644 --- a/Creating a WebSocket Chat with Ktor/05_creating_the_chat_client.md +++ b/Creating a WebSocket Chat with Ktor/05_creating_the_chat_client.md @@ -73,7 +73,7 @@ suspend fun DefaultClientWebSocketSession.inputMessages() { try { send(message) } catch (e: Exception) { - println("Error while sending: " + e.localizedMessage) + e as? CancellationException ?: println("Error while receiving: " + e.localizedMessage) return } }