Skip to content

Commit c1635ee

Browse files
committed
Clarify behavior of ServiceMessage#errorType with javadoc
1 parent 702d642 commit c1635ee

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

services-api/src/main/java/io/scalecube/services/api/ServiceMessage.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ public final class ServiceMessage {
2828
/** Error type header. */
2929
public static final String HEADER_ERROR_TYPE = "errorType";
3030

31+
/** Null value for error type. */
32+
public static final int NULL_ERROR_TYPE = -1;
33+
3134
private final Map<String, String> headers;
3235
private Object data;
3336

@@ -170,12 +173,12 @@ public boolean isError() {
170173
/**
171174
* Returns error type. Error type is an identifier of a group of errors.
172175
*
173-
* @return error type.
176+
* @return error type if set otherwise {@value NULL_ERROR_TYPE}.
174177
*/
175178
public int errorType() {
176179
String errorType = headers.get(HEADER_ERROR_TYPE);
177180
if (errorType == null) {
178-
return -1;
181+
return NULL_ERROR_TYPE;
179182
}
180183
try {
181184
return Integer.parseInt(errorType);

0 commit comments

Comments
 (0)