KeeperException (Apache ZooKeeper - Server 3.7.0 API)
Date: 2021-03-17

org.apache.zookeeper

## Class KeeperException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - org.apache.zookeeper.KeeperException

- All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    KeeperException.APIErrorException, KeeperException.AuthFailedException, KeeperException.BadArgumentsException, KeeperException.BadVersionException, KeeperException.ConnectionLossException, KeeperException.DataInconsistencyException, KeeperException.EphemeralOnLocalSessionException, KeeperException.InvalidACLException, KeeperException.InvalidCallbackException, KeeperException.MarshallingErrorException, KeeperException.NewConfigNoQuorum, KeeperException.NoAuthException, KeeperException.NoChildrenForEphemeralsException, KeeperException.NodeExistsException, KeeperException.NoNodeException, KeeperException.NotEmptyException, KeeperException.NotReadOnlyException, KeeperException.NoWatcherException, KeeperException.OperationTimeoutException, KeeperException.QuotaExceededException, KeeperException.ReconfigDisabledException, KeeperException.ReconfigInProgress, KeeperException.RequestTimeoutException, KeeperException.RuntimeInconsistencyException, KeeperException.SessionClosedRequireAuthException, KeeperException.SessionExpiredException, KeeperException.SessionMovedException, KeeperException.SystemErrorException, KeeperException.ThrottledOpException, KeeperException.UnimplementedException, KeeperException.UnknownSessionException

      @InterfaceAudience.Public
      public abstract class KeeperException
      extends Exception

  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `KeeperException.APIErrorException`
    `static class` | `KeeperException.AuthFailedException`
    `static class` | `KeeperException.BadArgumentsException`
    `static class` | `KeeperException.BadVersionException`
    `static class` | `KeeperException.Code` Codes which represent the various KeeperException types.
    `static interface` | `KeeperException.CodeDeprecated` Deprecated.
    `static class` | `KeeperException.ConnectionLossException`
    `static class` | `KeeperException.DataInconsistencyException`
    `static class` | `KeeperException.EphemeralOnLocalSessionException`
    `static class` | `KeeperException.InvalidACLException`
    `static class` | `KeeperException.InvalidCallbackException`
    `static class` | `KeeperException.MarshallingErrorException`
    `static class` | `KeeperException.NewConfigNoQuorum`
    `static class` | `KeeperException.NoAuthException`
    `static class` | `KeeperException.NoChildrenForEphemeralsException`
    `static class` | `KeeperException.NodeExistsException`
    `static class` | `KeeperException.NoNodeException`
    `static class` | `KeeperException.NotEmptyException`
    `static class` | `KeeperException.NotReadOnlyException`
    `static class` | `KeeperException.NoWatcherException`
    `static class` | `KeeperException.OperationTimeoutException`
    `static class` | `KeeperException.QuotaExceededException`
    `static class` | `KeeperException.ReconfigDisabledException`
    `static class` | `KeeperException.ReconfigInProgress`
    `static class` | `KeeperException.RequestTimeoutException`
    `static class` | `KeeperException.RuntimeInconsistencyException`
    `static class` | `KeeperException.SessionClosedRequireAuthException`
    `static class` | `KeeperException.SessionExpiredException`
    `static class` | `KeeperException.SessionMovedException`
    `static class` | `KeeperException.SystemErrorException`
    `static class` | `KeeperException.ThrottledOpException`
    `static class` | `KeeperException.UnimplementedException`
    `static class` | `KeeperException.UnknownSessionException`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `KeeperException(KeeperException.Code code)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `KeeperException.Code` | `code()` Read the error Code for this exception
    `static KeeperException` | `create(int code)` Deprecated. deprecated in 3.1.0, use `create(Code)` instead
    `static KeeperException` | `create(int code, String path)` Deprecated. deprecated in 3.1.0, use `create(Code, String)` instead
    `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.
    `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.
    `int` | `getCode()` Deprecated. deprecated in 3.1.0, use `code()` instead
    `String` | `getMessage()`
    `String` | `getPath()` Read the path for this exception
    `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.
    `void` | `setCode(int code)` Deprecated. deprecated in 3.1.0, exceptions should be immutable, this method should not be used

    - ### Methods inherited from class java.lang.Throwable

      `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### KeeperException

          public KeeperException(KeeperException.Code code)

  - ### 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

          @Deprecated
          public static KeeperException create(int code,
                                                           String path)

      Deprecated. deprecated in 3.1.0, use `create(Code, String)` instead

    - #### create

          @Deprecated
          public static KeeperException create(int code)

      Deprecated. deprecated in 3.1.0, use `create(Code)` instead

    - #### 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

    - #### getMessage

          public String getMessage()

      Overrides:
        `getMessage` in class `Throwable`

    - #### 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

Copyright © 2008–2021 The Apache Software Foundation. All rights reserved.