Example #1
0
  static SQLException create(String messageCode) {
    assert (messageCode != null) : "Fill parameters";

    String message = translateMsg(messageCode, null);
    String sqlState = language.getSqlState(messageCode);
    return new SmallSQLException(message, sqlState);
  }
Example #2
0
 static SQLException createFromException(Throwable e) {
   if (e instanceof SQLException) {
     return (SQLException) e;
   } else {
     String message = stripMsg(e);
     String sqlState = language.getSqlState(Language.CUSTOM_MESSAGE);
     return new SmallSQLException(e, message, sqlState);
   }
 }
Example #3
0
 /**
  * Create an exception with the specified message and appends the passed exception.<br>
  * Makes use of localization. String type is used to avoid possible confusion with future
  * implementations of Object[].
  *
  * @param messageCode localized message key. pass CUSTOM_MESSAGE and the plain message as param0
  *     to create an unlocalized message.
  * @param param0 message parameter.
  */
 static SQLException createFromException(String messageCode, Object param0, Throwable e) {
   String message = translateMsg(messageCode, new Object[] {param0});
   String sqlState = language.getSqlState(messageCode);
   return new SmallSQLException(e, message, sqlState);
 }
Example #4
0
 static SQLException create(String messageCode, Object[] params) {
   String message = translateMsg(messageCode, params);
   String sqlState = language.getSqlState(messageCode);
   return new SmallSQLException(message, sqlState);
 }