From c122f502249fb505c31165d5c97ba50caa0a3a33 Mon Sep 17 00:00:00 2001 From: Geir Storli Date: Mon, 5 Feb 2018 13:36:27 +0100 Subject: Use separate error code for UNKNOWN_BUCKET_SPACE. --- .../main/java/com/yahoo/document/restapi/OperationHandlerImpl.java | 2 +- .../src/main/java/com/yahoo/document/restapi/RestUri.java | 5 +++-- .../java/com/yahoo/document/restapi/OperationHandlerImplTest.java | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'vespaclient-container-plugin') 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}]}")); } } -- cgit v1.2.3