- All Implemented Interfaces:
Serializable,Comparable<ErrorKind>,Constable
ErrorEnvelope carries, a closed set.
Each kind determines the HTTP status of the error response and the severity at which the server logs it, and it is the only type information crossing the wire, the client mapping it to a known exception constructor. A class name plus reflective instantiation would reintroduce the arbitrary-instantiation problem the envelope exists to remove, so an unrecognized kind, which a client older than the server encounters, must be treated as a generic error rather than resolved.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe severity at which the server logs an error.Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAuthentication failed, or the credentials, client id or client type headers are missing or malformed.The request is malformed, an unparseable body, an unknown entity type or attribute name, a malformed header.An entity being updated has been modified or deleted since it was loaded.A referential integrity constraint prevented the operation.A unique constraint prevented the operation.The server is at its connection limit.A database error with no more specific kind.A delete failed.The request is at odds with the state of the connection, committing when no transaction is open, or with the state of the domain, calling an operation whose parameter type is not registered.An insert failed.Anything else, the server is at fault.One entity was expected but many were found.An expected entity was not found.A statement timed out or was cancelled.A report failed to fill or export.An update failed. -
Method Summary
-
Enum Constant Details
-
AUTHENTICATION
Authentication failed, or the credentials, client id or client type headers are missing or malformed. -
BAD_REQUEST
The request is malformed, an unparseable body, an unknown entity type or attribute name, a malformed header. -
ILLEGAL_STATE
The request is at odds with the state of the connection, committing when no transaction is open, or with the state of the domain, calling an operation whose parameter type is not registered.Logged at
ErrorKind.Severity.WARN, being a programming error on one side or the other, and reported asIllegalStateException, whichEntityConnection's transaction methods document. -
CONNECTION_UNAVAILABLE
The server is at its connection limit. -
CONFLICT_MODIFIED
An entity being updated has been modified or deleted since it was loaded. -
CONFLICT_REFERENTIAL
A referential integrity constraint prevented the operation. -
CONFLICT_UNIQUE
A unique constraint prevented the operation. -
NOT_FOUND
An expected entity was not found. -
MULTIPLE_FOUND
One entity was expected but many were found. -
INSERT
An insert failed. -
UPDATE
An update failed. -
DELETE
A delete failed. -
QUERY_TIMEOUT
A statement timed out or was cancelled. -
REPORT
A report failed to fill or export.The message is passed verbatim, unlike
INTERNAL, the plugin producing it having already stripped any reporting engine type, so a client without the engine reconstructs the failure as aReportException, which lives in common-db. A serial client receives that same exception directly, so the message reaches both.Logged at
ErrorKind.Severity.ERROR, a report failure being a data or deployment fault, a missing exporter extension for one. -
DATABASE
A database error with no more specific kind. -
INTERNAL
Anything else, the server is at fault. The message is replaced with a generic one, theErrorEnvelope.correlationId()being the client's only link to the server log.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
status
public int status()- Returns:
- the HTTP status of an error response of this kind
-
severity
- Returns:
- the severity at which the server logs an error of this kind
-
of
Returns theErrorKindwith the given name, an emptyOptionalif none exists, which is how a client older than the server encounters a kind it does not know.- Parameters:
name- the kind name- Returns:
- the
ErrorKindwith the given name
-