congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
DbException.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.h2.message.DbException
constructor

Best Java code snippets using org.h2.message.DbException.<init> (Showing top 16 results out of 315)

origin: com.h2database/h2

/**
 * Create a database exception for a specific error code.
 *
 * @param errorCode the error code
 * @param params the list of parameters of the message
 * @return the exception
 */
public static DbException get(int errorCode, String... params) {
  return new DbException(getJdbcSQLException(errorCode, null, params));
}
origin: com.h2database/h2

/**
 * Create a database exception for a specific error code.
 *
 * @param errorCode the error code
 * @param cause the cause of the exception
 * @param params the list of parameters of the message
 * @return the exception
 */
public static DbException get(int errorCode, Throwable cause,
    String... params) {
  return new DbException(getJdbcSQLException(errorCode, cause, params));
}
origin: com.h2database/h2

/**
 * Create a database exception for an arbitrary SQLState.
 *
 * @param sqlstate the state to use
 * @param message the message to use
 * @return the exception
 */
public static DbException fromUser(String sqlstate, String message) {
  // do not translate as sqlstate is arbitrary : avoid "message not found"
  return new DbException(new JdbcSQLException(message, null, sqlstate, 0, null, null));
}
origin: com.h2database/h2

/**
 * Create a syntax error exception.
 *
 * @param sql the SQL statement
 * @param index the position of the error in the SQL statement
 * @param message the message
 * @return the exception
 */
public static DbException getSyntaxError(String sql, int index,
    String message) {
  sql = StringUtils.addAsterisk(sql, index);
  return new DbException(getJdbcSQLException(ErrorCode.SYNTAX_ERROR_2,
      null, sql, message));
}
origin: com.h2database/h2

/**
 * Set the SQL statement of the given exception.
 * This method may create a new object.
 *
 * @param sql the SQL statement
 * @return the exception
 */
public DbException addSQL(String sql) {
  SQLException e = getSQLException();
  if (e instanceof JdbcSQLException) {
    JdbcSQLException j = (JdbcSQLException) e;
    if (j.getSQL() == null) {
      j.setSQL(sql);
    }
    return this;
  }
  e = new JdbcSQLException(e.getMessage(), sql, e.getSQLState(),
      e.getErrorCode(), e, null);
  return new DbException(e);
}
origin: com.h2database/h2

/**
 * Convert a throwable to an SQL exception using the default mapping. All
 * errors except the following are re-thrown: StackOverflowError,
 * LinkageError.
 *
 * @param e the root cause
 * @return the exception object
 */
public static DbException convert(Throwable e) {
  if (e instanceof DbException) {
    return (DbException) e;
  } else if (e instanceof SQLException) {
    return new DbException((SQLException) e);
  } else if (e instanceof InvocationTargetException) {
    return convertInvocation((InvocationTargetException) e, null);
  } else if (e instanceof IOException) {
    return get(ErrorCode.IO_EXCEPTION_1, e, e.toString());
  } else if (e instanceof OutOfMemoryError) {
    return get(ErrorCode.OUT_OF_MEMORY, e);
  } else if (e instanceof StackOverflowError || e instanceof LinkageError) {
    return get(ErrorCode.GENERAL_ERROR_1, e, e.toString());
  } else if (e instanceof Error) {
    throw (Error) e;
  }
  return get(ErrorCode.GENERAL_ERROR_1, e, e.toString());
}
origin: com.eventsourcing/h2

/**
 * Create a database exception for a specific error code.
 *
 * @param errorCode the error code
 * @param cause the cause of the exception
 * @param params the list of parameters of the message
 * @return the exception
 */
public static DbException get(int errorCode, Throwable cause,
    String... params) {
  return new DbException(getJdbcSQLException(errorCode, cause, params));
}
origin: org.wowtools/h2

/**
 * Create a database exception for a specific error code.
 *
 * @param errorCode the error code
 * @param params the list of parameters of the message
 * @return the exception
 */
public static DbException get(int errorCode, String... params) {
  return new DbException(getJdbcSQLException(errorCode, null, params));
}
origin: org.wowtools/h2

/**
 * Create a database exception for a specific error code.
 *
 * @param errorCode the error code
 * @param cause the cause of the exception
 * @param params the list of parameters of the message
 * @return the exception
 */
public static DbException get(int errorCode, Throwable cause,
    String... params) {
  return new DbException(getJdbcSQLException(errorCode, cause, params));
}
origin: com.eventsourcing/h2

/**
 * Create a database exception for a specific error code.
 *
 * @param errorCode the error code
 * @param params the list of parameters of the message
 * @return the exception
 */
public static DbException get(int errorCode, String... params) {
  return new DbException(getJdbcSQLException(errorCode, null, params));
}
origin: com.eventsourcing/h2

/**
 * Create a syntax error exception.
 *
 * @param sql the SQL statement
 * @param index the position of the error in the SQL statement
 * @param message the message
 * @return the exception
 */
public static DbException getSyntaxError(String sql, int index,
    String message) {
  sql = StringUtils.addAsterisk(sql, index);
  return new DbException(getJdbcSQLException(ErrorCode.SYNTAX_ERROR_2,
      null, sql, message));
}
origin: org.wowtools/h2

/**
 * Create a syntax error exception.
 *
 * @param sql the SQL statement
 * @param index the position of the error in the SQL statement
 * @param message the message
 * @return the exception
 */
public static DbException getSyntaxError(String sql, int index,
    String message) {
  sql = StringUtils.addAsterisk(sql, index);
  return new DbException(getJdbcSQLException(ErrorCode.SYNTAX_ERROR_2,
      null, sql, message));
}
origin: org.wowtools/h2

/**
 * Set the SQL statement of the given exception.
 * This method may create a new object.
 *
 * @param sql the SQL statement
 * @return the exception
 */
public DbException addSQL(String sql) {
  SQLException e = getSQLException();
  if (e instanceof JdbcSQLException) {
    JdbcSQLException j = (JdbcSQLException) e;
    if (j.getSQL() == null) {
      j.setSQL(sql);
    }
    return this;
  }
  e = new JdbcSQLException(e.getMessage(), sql, e.getSQLState(),
      e.getErrorCode(), e, null);
  return new DbException(e);
}
origin: com.eventsourcing/h2

/**
 * Set the SQL statement of the given exception.
 * This method may create a new object.
 *
 * @param sql the SQL statement
 * @return the exception
 */
public DbException addSQL(String sql) {
  SQLException e = getSQLException();
  if (e instanceof JdbcSQLException) {
    JdbcSQLException j = (JdbcSQLException) e;
    if (j.getSQL() == null) {
      j.setSQL(sql);
    }
    return this;
  }
  e = new JdbcSQLException(e.getMessage(), sql, e.getSQLState(),
      e.getErrorCode(), e, null);
  return new DbException(e);
}
origin: org.wowtools/h2

/**
 * Convert a throwable to an SQL exception using the default mapping. All
 * errors except the following are re-thrown: StackOverflowError,
 * LinkageError.
 *
 * @param e the root cause
 * @return the exception object
 */
public static DbException convert(Throwable e) {
  if (e instanceof DbException) {
    return (DbException) e;
  } else if (e instanceof SQLException) {
    return new DbException((SQLException) e);
  } else if (e instanceof InvocationTargetException) {
    return convertInvocation((InvocationTargetException) e, null);
  } else if (e instanceof IOException) {
    return get(ErrorCode.IO_EXCEPTION_1, e, e.toString());
  } else if (e instanceof OutOfMemoryError) {
    return get(ErrorCode.OUT_OF_MEMORY, e);
  } else if (e instanceof StackOverflowError || e instanceof LinkageError) {
    return get(ErrorCode.GENERAL_ERROR_1, e, e.toString());
  } else if (e instanceof Error) {
    throw (Error) e;
  }
  return get(ErrorCode.GENERAL_ERROR_1, e, e.toString());
}
origin: com.eventsourcing/h2

/**
 * Convert a throwable to an SQL exception using the default mapping. All
 * errors except the following are re-thrown: StackOverflowError,
 * LinkageError.
 *
 * @param e the root cause
 * @return the exception object
 */
public static DbException convert(Throwable e) {
  if (e instanceof DbException) {
    return (DbException) e;
  } else if (e instanceof SQLException) {
    return new DbException((SQLException) e);
  } else if (e instanceof InvocationTargetException) {
    return convertInvocation((InvocationTargetException) e, null);
  } else if (e instanceof IOException) {
    return get(ErrorCode.IO_EXCEPTION_1, e, e.toString());
  } else if (e instanceof OutOfMemoryError) {
    return get(ErrorCode.OUT_OF_MEMORY, e);
  } else if (e instanceof StackOverflowError || e instanceof LinkageError) {
    return get(ErrorCode.GENERAL_ERROR_1, e, e.toString());
  } else if (e instanceof Error) {
    throw (Error) e;
  }
  return get(ErrorCode.GENERAL_ERROR_1, e, e.toString());
}
org.h2.messageDbException<init>

Popular methods of DbException

  • getUnsupportedException
    Gets a SQL exception meaning this feature is not supported.
  • throwInternalError
    Throw an internal error. This method seems to return an exception object, so that it can be used ins
  • convert
    Convert a throwable to an SQL exception using the default mapping. All errors except the following a
  • get
    Create a database exception for a specific error code.
  • addSQL
    Set the SQL statement of the given exception. This method may create a new object.
  • convertIOException
    Convert an IO exception to a database exception.
  • convertInvocation
    Convert an InvocationTarget exception to a database exception.
  • convertToIOException
    Convert an exception to an IO exception.
  • getCause
  • getErrorCode
    Get the error code.
  • getInvalidValueException
    Gets a SQL exception meaning this value is invalid.
  • getJdbcSQLException
    Gets the SQL exception object for a specific error code.
  • getInvalidValueException,
  • getJdbcSQLException,
  • getMessage,
  • getSQLException,
  • getSource,
  • getSyntaxError,
  • printStackTrace,
  • setSource,
  • toSQLException

Popular in Java

  • Updating database using SQL prepared statement
  • putExtra (Intent)
  • getSharedPreferences (Context)
  • getExternalFilesDir (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • 21 Best Atom Packages for 2021
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now