joffrey-bion / krossbow

A Kotlin multiplatform coroutine-based STOMP client over websockets, with built-in conversions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Define a specific `SessionDisconnectedException` to represent STOMP frames completion

joffrey-bion opened this issue · comments

Problem / use case

When sending frames and waiting for receipts, the session might be disconnected in the meantime. This currently throws an IllegalStateException, which is not very user friendly: we don't want to explicitly catch this exception, but we want to be able to handle such errors when making send() calls.

Feature (solution)

If the user of the StompSession decided to disconnect while another coroutine was waiting for a receipt, we could (should?) throw a specific SessionDisconnectedException instead of IllegalStateException.

Current alternatives

Catch the IllegalStateException and analyze the message... which is quite brittle and not very maintainable.