@ProviderType
public class KuraException
extends java.lang.Exception
KuraException
class is the superclass of all errors and exceptions in the Kura project. It extends the
JDK Exception
class by requesting its invokers to provide an error code when building its instances. The code
is one value of KuraErrorCode
; the code is used to document the possible error conditions generated by the
platform as well as to identify the localized exception messages to be reported. Exceptions messages are stored in
the KuraExceptionMessagesBundle
Properties Bundle and they are keyed on the exception code.KuraErrorCode
,
Serialized FormConstructor and Description |
---|
KuraException(KuraErrorCode code)
Builds a new
KuraException instance based on the supplied KuraErrorCode . |
KuraException(KuraErrorCode code,
java.lang.Object... arguments)
Builds a new
KuraException instance based on the supplied KuraErrorCode . |
KuraException(KuraErrorCode code,
java.lang.Throwable cause,
java.lang.Object... arguments)
Builds a new
KuraException instance based on the supplied KuraErrorCode , an optional Throwable
cause, and optional arguments for the associated exception message. |
Modifier and Type | Method and Description |
---|---|
KuraErrorCode |
getCode()
Gets the error code.
|
java.lang.String |
getLocalizedMessage() |
java.lang.String |
getMessage() |
static KuraException |
internalError(java.lang.String message)
Factory method to build an
KuraException with the KuraErrorCode.INTERNAL_ERROR code providing
only a message. |
static KuraException |
internalError(java.lang.Throwable cause)
Factory method to build an
KuraException with the KuraErrorCode.INTERNAL_ERROR code providing a
cause and a message. |
static KuraException |
internalError(java.lang.Throwable cause,
java.lang.String message)
Factory method to build an
KuraException with the KuraErrorCode.INTERNAL_ERROR code providing a
cause and a message. |
public KuraException(KuraErrorCode code)
KuraException
instance based on the supplied KuraErrorCode
.code
- the error codepublic KuraException(KuraErrorCode code, java.lang.Object... arguments)
KuraException
instance based on the supplied KuraErrorCode
.code
- the error codearguments
- the argumentspublic KuraException(KuraErrorCode code, java.lang.Throwable cause, java.lang.Object... arguments)
KuraException
instance based on the supplied KuraErrorCode
, an optional Throwable
cause, and optional arguments for the associated exception message.code
- the error codecause
- the causearguments
- the argumentspublic static KuraException internalError(java.lang.String message)
KuraException
with the KuraErrorCode.INTERNAL_ERROR
code providing
only a message. This method internally sets the error code to KuraErrorCode.INTERNAL_ERROR
which is not
meaningful at all for exception translations. That is why, the use of this method is highly discouraged.
Hence, the advised way to construct a KuraException
is to use its constructor with a proper
KuraErrorCode
.message
- the messagepublic static KuraException internalError(java.lang.Throwable cause)
KuraException
with the KuraErrorCode.INTERNAL_ERROR
code providing a
cause and a message. This method internally sets the error code to KuraErrorCode.INTERNAL_ERROR
which is
not meaningful at all for exception translations. That is why, the use of this method is highly
discouraged. Hence, the advised way to construct a KuraException
is to use its constructor with a
proper KuraErrorCode
.cause
- the causepublic static KuraException internalError(java.lang.Throwable cause, java.lang.String message)
KuraException
with the KuraErrorCode.INTERNAL_ERROR
code providing a
cause and a message. This method internally sets the error code to KuraErrorCode.INTERNAL_ERROR
which is
not meaningful at all for exception translations. That is why, the use of this method is highly
discouraged. Hence, the advised way to construct a KuraException
is to use its constructor with a
proper KuraErrorCode
.cause
- the causemessage
- the messagepublic KuraErrorCode getCode()
public java.lang.String getLocalizedMessage()
getLocalizedMessage
in class java.lang.Throwable
public java.lang.String getMessage()
getMessage
in class java.lang.Throwable