Skip to content

Commit

Permalink
space deletion : fix 500 err on successive calls
Browse files Browse the repository at this point in the history
Signed-off-by: qGYdXbY2 <[email protected]>
  • Loading branch information
qGYdXbY2 committed Feb 7, 2025
1 parent 9b329e3 commit f66c36b
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,17 @@
import com.here.xyz.hub.config.SpaceConfigClient;
import com.here.xyz.hub.connectors.models.Space;
import com.here.xyz.util.ARN;
import com.here.xyz.util.service.HttpException;
import com.here.xyz.util.service.aws.dynamo.DynamoClient;
import com.here.xyz.util.service.aws.dynamo.IndexDefinition;

import io.netty.handler.codec.http.HttpResponseStatus;
import io.vertx.core.Future;
import io.vertx.core.Promise;
import io.vertx.core.json.Json;
import io.vertx.core.json.jackson.DatabindCodec;

import java.net.http.HttpResponse;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -197,10 +202,11 @@ public Future<Space> deleteSpace(Marker marker, String spaceId) {
return get(marker, spaceId)
.onFailure(t -> logger.error(marker, "Failure to get space ID: {} during space deletion", spaceId, t))
.compose(space -> {
space = null;
if (space == null) {
String errMsg = String.format("Space ID: %s is null after retrieval during space deletion", spaceId);
String errMsg = String.format("Space ID '%s' - space is null during space deletion", spaceId);
logger.error(marker,errMsg);
return Future.failedFuture(errMsg);
return Future.failedFuture(new HttpException(HttpResponseStatus.NOT_FOUND,errMsg));
} else {
logger.info(marker, "Space ID: {} has been retrieved", space.getId());
return Future.succeededFuture(space);
Expand Down

0 comments on commit f66c36b

Please sign in to comment.