Class ErrorUtils


  • public class ErrorUtils
    extends Object
    Utilities for creating SQLException and SQLWarnings from PostgreSQL's "Notice" and "Error" message data
    • Constructor Detail

      • ErrorUtils

        public ErrorUtils()
    • 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​(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 chain
        add - Warning chain to append to base
        Returns:
        Head of the new complete warning chain