Class ErrorUtils


  • public class ErrorUtils
    extends java.lang.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 java.sql.SQLWarning chainWarnings​(java.sql.SQLWarning base, RequestExecutorHandlers.Result result)  
      static java.sql.SQLWarning chainWarnings​(java.sql.SQLWarning base, java.sql.SQLWarning add)
      Creates a single chain of warnings.
      static java.sql.SQLException makeSQLException​(Notice notice)
      Converts a single error notice to a single SQLException
      static java.sql.SQLException makeSQLException​(java.lang.Exception cause)  
      static java.sql.SQLException makeSQLException​(java.lang.String message, Notice notice)
      Converts a single error notice to a single SQLException
      static java.sql.SQLException makeSQLException​(java.lang.String message, java.lang.Exception cause)  
      static java.sql.SQLException makeSQLException​(java.lang.String message, java.lang.String sqlState, java.lang.Exception cause)  
      static java.sql.SQLException makeSQLExceptionChain​(java.util.List<Notice> notices)
      Converts the given list of notices into a chained list of SQLExceptions
      static java.sql.SQLWarning makeSQLWarning​(Notice notice)
      Converts a single warning notice to a single SQLWarning
      static java.sql.SQLWarning makeSQLWarningChain​(java.util.List<Notice> notices)
      Converts the given list of notices into a chained list of SQLWarnings
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ErrorUtils

        public ErrorUtils()
    • Method Detail

      • makeSQLWarningChain

        public static java.sql.SQLWarning makeSQLWarningChain​(java.util.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 java.sql.SQLException makeSQLExceptionChain​(java.util.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 java.sql.SQLWarning makeSQLWarning​(Notice notice)
        Converts a single warning notice to a single SQLWarning
        Parameters:
        notice - Notice to convert
        Returns:
        SQLWarning
      • makeSQLException

        public static java.sql.SQLException makeSQLException​(java.lang.String message,
                                                             java.lang.String sqlState,
                                                             java.lang.Exception cause)
      • makeSQLException

        public static java.sql.SQLException makeSQLException​(java.lang.String message,
                                                             java.lang.Exception cause)
      • makeSQLException

        public static java.sql.SQLException makeSQLException​(java.lang.Exception cause)
      • makeSQLException

        public static java.sql.SQLException makeSQLException​(Notice notice)
        Converts a single error notice to a single SQLException
        Parameters:
        notice - Notice to convert
        Returns:
        SQLException
      • makeSQLException

        public static java.sql.SQLException makeSQLException​(java.lang.String message,
                                                             Notice notice)
        Converts a single error notice to a single SQLException
        Parameters:
        notice - Notice to convert
        Returns:
        SQLException
      • chainWarnings

        public static java.sql.SQLWarning chainWarnings​(java.sql.SQLWarning base,
                                                        java.sql.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 chain
        add - Warning chain to append to base
        Returns:
        Head of the new complete warning chain