Package org.eclipse.ditto.json
Class JsonRuntimeException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.eclipse.ditto.json.JsonRuntimeException
-
- All Implemented Interfaces:
java.io.Serializable
,JsonException
- Direct Known Subclasses:
JsonFieldSelectorInvalidException
,JsonKeyInvalidException
,JsonMissingFieldException
,JsonParseException
,JsonPointerInvalidException
public class JsonRuntimeException extends java.lang.RuntimeException implements JsonException
Common base type of all unchecked JSON exceptions.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JsonRuntimeException.Builder
A mutable builder for aJsonRuntimeException
.
-
Constructor Summary
Constructors Modifier Constructor Description protected
JsonRuntimeException(java.lang.String errorCode, java.lang.String message, java.lang.String description, java.lang.Throwable cause, java.net.URI href)
Constructs a newJsonRuntimeException
object with the specified values.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<java.lang.String>
getDescription()
Returns the description which should be reported to the user.java.lang.String
getErrorCode()
Returns the error code to uniquely identify this exception.java.util.Optional<java.net.URI>
getHref()
Returns a link with which the user can find further information regarding this exception.static JsonExceptionBuilder<JsonRuntimeException>
newBuilder(java.lang.String errorCode)
Returns a builder for fluently creating instances ofJsonRuntimeException
s..
-
-
-
Constructor Detail
-
JsonRuntimeException
protected JsonRuntimeException(java.lang.String errorCode, @Nullable java.lang.String message, @Nullable java.lang.String description, @Nullable java.lang.Throwable cause, @Nullable java.net.URI href)
Constructs a newJsonRuntimeException
object with the specified values.- Parameters:
errorCode
- the error code of the exception.message
- the detail message for later retrieval withThrowable.getMessage()
.description
- a description with further information about the exception.cause
- the cause of the exception for later retrieval withThrowable.getCause()
.href
- a link to a resource which provides further information about the exception.- Throws:
java.lang.NullPointerException
- iferrorCode
isnull
.java.lang.IllegalArgumentException
- iferrorCode
is empty.
-
-
Method Detail
-
newBuilder
public static JsonExceptionBuilder<JsonRuntimeException> newBuilder(java.lang.String errorCode)
Returns a builder for fluently creating instances ofJsonRuntimeException
s..- Parameters:
errorCode
- a code which uniquely identifies the exception.- Returns:
- a new builder for JsonRuntimeException objects.
- Throws:
java.lang.NullPointerException
- iferrorCode
isnull
.java.lang.IllegalArgumentException
- iferrorCode
is empty.
-
getErrorCode
public java.lang.String getErrorCode()
Description copied from interface:JsonException
Returns the error code to uniquely identify this exception.- Specified by:
getErrorCode
in interfaceJsonException
- Returns:
- the error code.
-
getDescription
public java.util.Optional<java.lang.String> getDescription()
Description copied from interface:JsonException
Returns the description which should be reported to the user.- Specified by:
getDescription
in interfaceJsonException
- Returns:
- the description.
-
getHref
public java.util.Optional<java.net.URI> getHref()
Description copied from interface:JsonException
Returns a link with which the user can find further information regarding this exception.- Specified by:
getHref
in interfaceJsonException
- Returns:
- a link to provide the user with further information about this exception.
-
-