summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeir Storli <geirst@oath.com>2018-02-05 13:36:27 +0100
committerGeir Storli <geirst@oath.com>2018-02-05 13:48:22 +0100
commitc122f502249fb505c31165d5c97ba50caa0a3a33 (patch)
tree115f2c536f0d4fb028ac69c11c3577b16162d846
parentb6df23d444aee889f5a275e0428f89d024d46bce (diff)
Use separate error code for UNKNOWN_BUCKET_SPACE.
-rw-r--r--vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/OperationHandlerImpl.java2
-rw-r--r--vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/RestUri.java5
-rw-r--r--vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/OperationHandlerImplTest.java2
3 files changed, 5 insertions, 4 deletions
diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/OperationHandlerImpl.java b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/OperationHandlerImpl.java
index d6ae4a9285a..af8650a8e7c 100644
--- a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/OperationHandlerImpl.java
+++ b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/OperationHandlerImpl.java
@@ -323,7 +323,7 @@ public class OperationHandlerImpl implements OperationHandler {
if (!targetBucketSpace.isPresent()) {
throw new RestApiException(Response.createErrorResponse(400, String.format(
"Document type '%s' in cluster '%s' is not mapped to a known bucket space", docType, clusterDef.getName()),
- RestUri.apiErrorCodes.UNKNOWN_BUCKET_SPACE)); // TODO own code
+ RestUri.apiErrorCodes.UNKNOWN_BUCKET_SPACE));
}
return new BucketSpaceRoute(clusterDefToRoute(clusterDef), targetBucketSpace.get());
}
diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/RestUri.java b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/RestUri.java
index 15d1b54adbe..e3423eec2c8 100644
--- a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/RestUri.java
+++ b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/RestUri.java
@@ -34,14 +34,15 @@ public class RestUri {
URL_PARSING(-6),
INVALID_CREATE_VALUE(-7),
TOO_MANY_PARALLEL_REQUESTS(-8),
- MISSING_CLUSTER(-9), UNKNOWN_BUCKET_SPACE(-9), INTERNAL_EXCEPTION(-9),
+ MISSING_CLUSTER(-9), INTERNAL_EXCEPTION(-9),
DOCUMENT_CONDITION_NOT_MET(-10),
DOCUMENT_EXCPETION(-11),
PARSER_ERROR(-11),
GROUP_AND_EXPRESSION_ERROR(-12),
TIME_OUT(-13),
INTERRUPTED(-14),
- UNSPECIFIED(-15);
+ UNSPECIFIED(-15),
+ UNKNOWN_BUCKET_SPACE(-16);
public final long value;
apiErrorCodes(long value) {
diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/OperationHandlerImplTest.java b/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/OperationHandlerImplTest.java
index 3a6782f5830..06054bd2dbb 100644
--- a/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/OperationHandlerImplTest.java
+++ b/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/OperationHandlerImplTest.java
@@ -212,7 +212,7 @@ public class OperationHandlerImplTest {
String errorMsg = renderRestApiExceptionAsString(e);
// FIXME isn't this really more of a case of unknown document type..?
assertThat(errorMsg, is("{\"errors\":[{\"description\":" +
- "\"UNKNOWN_BUCKET_SPACE Document type 'document-type' in cluster 'foo' is not mapped to a known bucket space\",\"id\":-9}]}"));
+ "\"UNKNOWN_BUCKET_SPACE Document type 'document-type' in cluster 'foo' is not mapped to a known bucket space\",\"id\":-16}]}"));
}
}