Class ErrorMap
- java.lang.Object
-
- com.couchbase.client.core.io.netty.kv.ErrorMap
-
- All Implemented Interfaces:
Comparable<ErrorMap>
public class ErrorMap extends Object implements Comparable<ErrorMap>
TheErrorMap
contains mappings from errors to their attributes, negotiated between the client and the server.From the documentation:
An Error Map is a mapping of error to their attributes and properties. It is used by connected clients to handle error codes which they may otherwise not be aware of.
The error map solves the problem where clients would incorrectly handle newer error codes, and/or where the server would disconnect the client because it needed to send it a new error code.
The solution via Error Map is to establish a contract between client and server about certain attributes which each error code may have. These attributes indicate whether an error may be passed through, whether the command is retriable and so on. When a client receives an error code it does not know about it, it can look up its attributes and then determine the next course of action.
- Since:
- 1.4.4
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ErrorMap.ErrorAttribute
static class
ErrorMap.ErrorCode
static class
ErrorMap.RetrySpecification
static class
ErrorMap.RetryStrategy
-
Constructor Summary
Constructors Constructor Description ErrorMap(int version, int revision, Map<String,ErrorMap.ErrorCode> errors)
Creates a new Error Map, usually called from jackson.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(ErrorMap o)
Map<Short,ErrorMap.ErrorCode>
errors()
static ErrorMap
fromJson(byte[] jsonBytes)
Creates a new ErrorMap by parsing the json representation.int
revision()
String
toString()
int
version()
-
-
-
Constructor Detail
-
ErrorMap
public ErrorMap(int version, int revision, Map<String,ErrorMap.ErrorCode> errors)
Creates a new Error Map, usually called from jackson.- Parameters:
version
- the error map version.revision
- the error map revision.errors
- the full error section.
-
-
Method Detail
-
fromJson
public static ErrorMap fromJson(byte[] jsonBytes) throws IOException
Creates a new ErrorMap by parsing the json representation.- Throws:
IOException
- if parsing failed
-
compareTo
public int compareTo(ErrorMap o)
- Specified by:
compareTo
in interfaceComparable<ErrorMap>
-
version
public int version()
-
revision
public int revision()
-
errors
public Map<Short,ErrorMap.ErrorCode> errors()
-
-