Class KeeperException

    • Method Detail

      • create

        public static KeeperException create​(KeeperException.Code code,
                                             String path)
        All non-specific keeper exceptions should be constructed via this factory method in order to guarantee consistency in error codes and such. If you know the error code, then you should construct the special purpose exception directly. That will allow you to have the most specific possible declarations of what exceptions might actually be thrown.
        Parameters:
        code - The error code.
        path - The ZooKeeper path being operated on.
        Returns:
        The specialized exception, presumably to be thrown by the caller.
      • create

        public static KeeperException create​(KeeperException.Code code)
        All non-specific keeper exceptions should be constructed via this factory method in order to guarantee consistency in error codes and such. If you know the error code, then you should construct the special purpose exception directly. That will allow you to have the most specific possible declarations of what exceptions might actually be thrown.
        Parameters:
        code - The error code of your new exception. This will also determine the specific type of the exception that is returned.
        Returns:
        The specialized exception, presumably to be thrown by the caller.
      • setCode

        @Deprecated
        public void setCode​(int code)
        Deprecated.
        deprecated in 3.1.0, exceptions should be immutable, this method should not be used
        Set the code for this exception
        Parameters:
        code - error code
      • getCode

        @Deprecated
        public int getCode()
        Deprecated.
        deprecated in 3.1.0, use code() instead
        Read the error code for this exception
        Returns:
        the error code for this exception
      • code

        public KeeperException.Code code()
        Read the error Code for this exception
        Returns:
        the error Code for this exception
      • getPath

        public String getPath()
        Read the path for this exception
        Returns:
        the path associated with this error, null if none
      • getResults

        public List<OpResult> getResults()
        If this exception was thrown by a multi-request then the (partial) results and error codes can be retrieved using this getter.
        Returns:
        A copy of the list of results from the operations in the multi-request.
        Since:
        3.4.0