Search in sources :

Example 1 with MySQLException

use of io.vertx.mysqlclient.MySQLException in project Mycat2 by MyCATApache.

the class NewVertxConnectionImpl method mapException.

private static Throwable mapException(Throwable throwable) {
    if (throwable instanceof MySQLException) {
        MySQLException mySQLException = (MySQLException) throwable;
        int errorCode = mySQLException.getErrorCode();
        String sqlState = mySQLException.getSqlState();
        String message = mySQLException.getMessage();
        throwable = new SQLException(message, sqlState, errorCode, throwable);
    }
    return throwable;
}
Also used : MySQLException(io.vertx.mysqlclient.MySQLException) MySQLException(io.vertx.mysqlclient.MySQLException) SQLException(java.sql.SQLException)

Example 2 with MySQLException

use of io.vertx.mysqlclient.MySQLException in project Mycat2 by MyCATApache.

the class Decoder method convertException.

default Throwable convertException(Buffer payload) {
    ReadView readView = new ReadView(payload);
    readView.skipInReading(1);
    int errorCode = (int) readView.readFixInt(2);
    readView.skipInReading(1);
    String sqlState = readView.readFixString(5);
    String errorMessage = readView.readEOFString();
    return (new MySQLException(errorMessage, errorCode, sqlState));
}
Also used : MySQLException(io.vertx.mysqlclient.MySQLException) ReadView(io.mycat.vertx.ReadView)

Aggregations

MySQLException (io.vertx.mysqlclient.MySQLException)2 ReadView (io.mycat.vertx.ReadView)1 SQLException (java.sql.SQLException)1