Package com.clickhouse.client
Class ClickHouseException
java.lang.Object
java.lang.Throwable
java.lang.Exception
com.clickhouse.client.ClickHouseException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ClickHouseTransactionException
Exception thrown from ClickHouse server. See full list at
https://github.com/ClickHouse/ClickHouse/blob/master/src/Common/ErrorCodes.cpp.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
ConstructorsModifierConstructorDescriptionClickHouseException
(int code, String message, ClickHouseNode server) Constructs an exception without cause.protected
ClickHouseException
(int code, String message, Throwable cause) Constructs an exception.ClickHouseException
(int code, Throwable cause, ClickHouseNode server) Constructs an exception with cause. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
buildErrorMessage
(int code, String detail) Builds error message like"Code: <code>, <detail>"
.static ClickHouseException
forCancellation
(Exception e, ClickHouseNode server) Creates an exception for cancellation.int
Gets error code.static boolean
Checks if the given exception represents connection timeout error.static ClickHouseException
of
(String message, ClickHouseNode server) Creates an exception to encapsulate the given error message.static ClickHouseException
of
(Throwable e, ClickHouseNode server) Creates an exception to encapsulate cause of the given exception.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
ERROR_ABORTED
public static final int ERROR_ABORTED- See Also:
-
ERROR_CANCELLED
public static final int ERROR_CANCELLED- See Also:
-
ERROR_NETWORK
public static final int ERROR_NETWORK- See Also:
-
ERROR_SESSION_NOT_FOUND
public static final int ERROR_SESSION_NOT_FOUND- See Also:
-
ERROR_SESSION_IS_LOCKED
public static final int ERROR_SESSION_IS_LOCKED- See Also:
-
ERROR_POCO
public static final int ERROR_POCO- See Also:
-
ERROR_TIMEOUT
public static final int ERROR_TIMEOUT- See Also:
-
ERROR_UNKNOWN
public static final int ERROR_UNKNOWN- See Also:
-
-
Constructor Details
-
ClickHouseException
Constructs an exception with cause.- Parameters:
code
- error codecause
- cause of the exceptionserver
- server
-
ClickHouseException
Constructs an exception without cause.- Parameters:
code
- error codemessage
- error messageserver
- server
-
ClickHouseException
Constructs an exception.- Parameters:
code
- error codemessage
- error messagecause
- cause
-
-
Method Details
-
buildErrorMessage
Builds error message like"Code: <code>, <detail>"
.- Parameters:
code
- error codedetail
- detail of the error- Returns:
- non-null error message
-
forCancellation
Creates an exception for cancellation.- Parameters:
e
- exceptionserver
- server- Returns:
- ClickHouseException
-
isConnectTimedOut
Checks if the given exception represents connection timeout error.- Parameters:
t
- exception- Returns:
- true if the exception represents connection timeout error; false otherwise
-
of
Creates an exception to encapsulate cause of the given exception.- Parameters:
e
- exceptionserver
- server- Returns:
- ClickHouseException
-
of
Creates an exception to encapsulate the given error message.- Parameters:
message
- error messageserver
- server- Returns:
- ClickHouseException
-
getErrorCode
public int getErrorCode()Gets error code.- Returns:
- error code
-