vert-x3 / vertx-stomp

STOMP client/server implementation
Apache License 2.0
31 stars 28 forks source link

Can't capture exceptions from connectAwait #54

Closed lfmunoz closed 5 years ago

lfmunoz commented 5 years ago

The way StompClient.connectAwait is implemented doesn't seem correct to me because it doesn allow to capture the exception awaitResult might throw.

When connecting you might not be able to connect for various reasons, that can be handled. The way it is implemented now connectAwait returns StompClientConnection or it swallows exceptions?

This WON"T work:

        try {
            stompClient.connectAwait()
        } catch( e: Exception) {
            println(e)
        }

So if I can't connect then what? I get an exception on the main event loop? This is what i see

io.vertx.core.impl.NoStackTraceThrowable: CONNECTED frame not receive in time

I think awaitConnect should really be more like this:

    val connectionResult = awaitEvent<AsyncResult<StompClientConnection>> {
            stompClient.connect(it)
        }

please correct me if I am wrong.

lfmunoz commented 5 years ago

Never mind this works just gotta catch Throwable