Package com.impossibl.postgres.jdbc
Class ErrorUtils
- java.lang.Object
-
- com.impossibl.postgres.jdbc.ErrorUtils
-
public class ErrorUtils extends Object
Utilities for creating SQLException and SQLWarnings from PostgreSQL's "Notice" and "Error" message data
-
-
Constructor Summary
Constructors Constructor Description ErrorUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SQLWarning
chainWarnings(SQLWarning base, RequestExecutorHandlers.Result result)
static SQLWarning
chainWarnings(SQLWarning base, SQLWarning add)
Creates a single chain of warnings.static SQLException
makeSQLException(Notice notice)
Converts a single error notice to a single SQLExceptionstatic SQLException
makeSQLException(Exception cause)
static SQLException
makeSQLException(String messagePrefix, Notice notice)
Converts a single error notice to a single SQLExceptionstatic SQLException
makeSQLException(String message, Exception cause)
static SQLException
makeSQLException(String messagePrefix, String sqlState, Exception cause)
static SQLException
makeSQLExceptionChain(List<Notice> notices)
Converts the given list of notices into a chained list of SQLExceptionsstatic SQLWarning
makeSQLWarning(Notice notice)
Converts a single warning notice to a single SQLWarningstatic SQLWarning
makeSQLWarningChain(List<Notice> notices)
Converts the given list of notices into a chained list of SQLWarnings
-
-
-
Method Detail
-
makeSQLWarningChain
public static SQLWarning makeSQLWarningChain(List<Notice> notices)
Converts the given list of notices into a chained list of SQLWarnings- Parameters:
notices
- List of notices to convert- Returns:
- Root of converted list or null is no notices were given
-
makeSQLExceptionChain
public static SQLException makeSQLExceptionChain(List<Notice> notices)
Converts the given list of notices into a chained list of SQLExceptions- Parameters:
notices
- List of notices to convert- Returns:
- Root of converted list or null is no notices were given
-
makeSQLWarning
public static SQLWarning makeSQLWarning(Notice notice)
Converts a single warning notice to a single SQLWarning- Parameters:
notice
- Notice to convert- Returns:
- SQLWarning
-
makeSQLException
public static SQLException makeSQLException(String messagePrefix, String sqlState, Exception cause)
-
makeSQLException
public static SQLException makeSQLException(String message, Exception cause)
-
makeSQLException
public static SQLException makeSQLException(Exception cause)
-
makeSQLException
public static SQLException makeSQLException(Notice notice)
Converts a single error notice to a single SQLException- Parameters:
notice
- Notice to convert- Returns:
- SQLException
-
makeSQLException
public static SQLException makeSQLException(String messagePrefix, Notice notice)
Converts a single error notice to a single SQLException- Parameters:
notice
- Notice to convert- Returns:
- SQLException
-
chainWarnings
public static SQLWarning chainWarnings(SQLWarning base, SQLWarning add)
Creates a single chain of warnings. The method attempts to append to the base chain but if no base is provided it returns the add chain.- Parameters:
base
- Base warning chainadd
- Warning chain to append to base- Returns:
- Head of the new complete warning chain
-
chainWarnings
public static SQLWarning chainWarnings(SQLWarning base, RequestExecutorHandlers.Result result)
-
-