Class ExceptionMapper


  • public class ExceptionMapper
    extends Object
    • Constructor Detail

      • ExceptionMapper

        public ExceptionMapper()
    • Method Detail

      • getException

        public static SQLException getException​(SQLException exception,
                                                MariaDbConnection connection,
                                                MariaDbStatement statement,
                                                boolean timeout)
        Helper to decorate exception with associate subclass of SQLException exception.
        Parameters:
        exception - exception
        connection - current connection
        statement - current statement
        timeout - was timeout on query
        Returns:
        SQLException exception
      • checkConnectionException

        public static void checkConnectionException​(SQLException exception,
                                                    MariaDbConnection connection)
        Check connection exception to report to poolConnection listeners.
        Parameters:
        exception - current exception
        connection - current connection
      • get

        public static SQLException get​(String message,
                                       String sqlState,
                                       int errorCode,
                                       Throwable exception,
                                       boolean timeout)
        Helper to decorate exception with associate subclass of SQLException exception.
        Parameters:
        message - exception message
        sqlState - sqlstate
        errorCode - errorCode
        exception - cause
        timeout - was timeout on query
        Returns:
        SQLException exception
      • getFeatureNotSupportedException

        public static SQLException getFeatureNotSupportedException​(String message)
      • mapCodeToSqlState

        public static String mapCodeToSqlState​(int code)
        Mapp code to State.
        Parameters:
        code - code
        Returns:
        String