vertx-sql-client
vertx-sql-client copied to clipboard
ConnectionPool.handleException(Throwable err) always not work
Questions
i want to query some data from db use MySQLPoolImpl,process the data and then return to browser use vertx-web
however when i handler the result from querystatemnt , it throw nullpointexception by accident, and i think i will rerouter to the exceptionhandler which i define in Router. but the truth is it do nothing,let the brower has no response
Version
3.9.6
my code :
mySQLPool.preparedQuery(sql).execute(tuple, ar -> {
int i = 1/0;
if (ar.succeeded()) {
//do somthing
} else {
//do somthing
}
});
and i debug to follow the stack to see how the vertx handler the exception ,i find out that:method(io.vertx.sqlclient.impl.ConnectionPool.PooledConnection#handleException) will always not to excute because the holder is always null.but i dont find the place to set holder.it's my carelessness or it 's a bug
private class PooledConnection implements Connection, Connection.Holder {
@Override
public void handleException(Throwable err) {
if (holder != null) {
holder.handleException(err);
}
}
}