Skip to content

Commit

Permalink
Increase the catch exception code
Browse files Browse the repository at this point in the history
Increase the catch exception code to ensure that when the exception occurs can be friendly to return to the client side
  • Loading branch information
holy12345 authored Nov 25, 2017
1 parent 47789f4 commit f075b42
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,16 +277,22 @@ public Response updateMetadata(@Context UriInfo uriInfo) {
@DELETE
public Response cancelLease(
@HeaderParam(PeerEurekaNode.HEADER_REPLICATION) String isReplication) {
boolean isSuccess = registry.cancel(app.getName(), id,
try {
boolean isSuccess = registry.cancel(app.getName(), id,
"true".equals(isReplication));

if (isSuccess) {
logger.debug("Found (Cancel): {} - {}", app.getName(), id);
return Response.ok().build();
} else {
logger.info("Not Found (Cancel): {} - {}", app.getName(), id);
return Response.status(Status.NOT_FOUND).build();
if (isSuccess) {
logger.debug("Found (Cancel): {} - {}", app.getName(), id);
return Response.ok().build();
} else {
logger.info("Not Found (Cancel): {} - {}", app.getName(), id);
return Response.status(Status.NOT_FOUND).build();
}
} catch (Throwable e) {
logger.error("Error (cancel): {} - {}", app.getName(), id, e);
return Response.serverError().build();
}

}

private Response validateDirtyTimestamp(Long lastDirtyTimestamp,
Expand Down

0 comments on commit f075b42

Please sign in to comment.