Skip to content

Exception was discarded, but it shouldn't #151

Closed
@okou19900722

Description

@okou19900722

when I invoke from client but not connection, it's will get connection and do action in the callback. if the action throw a exception, and no exception handler of Context was setting .The exception will discard.

also see #116

.whenCompleteAsync((connection, error) -> {
try {
if (error != null) {
logger.info("failed to create connection", error);
handler.handle(Future.failedFuture(error));
} else {
handler.handle(Future.succeededFuture(connection));
}
} catch (Throwable exception) {
Handler<Throwable> exceptionHandler = vertx.getOrCreateContext().exceptionHandler();
if (exceptionHandler != null) {
exceptionHandler.handle(exception);
} else {
throw exception;
}

client.queryWithParams("select * from player where id=?",JsonArray().add(1).add(2)) {
    // callback never execute
}
client.getConnection() {
    try {
        it.queryWithParams("select * from player where id=?",JsonArray().add(1).add(2)) {
            // do something
        }
    } catch(e : Throwable) {
        //got the exception
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions