YARN-8140. Improve log message when launch cmd is ran for stopped yarn service. Contributed by Eric Yang

This commit is contained in:
Billie Rinaldi 2018-04-26 12:52:22 -07:00 committed by Owen O'Malley
parent 4a7369b095
commit 598483e496
1 changed files with 6 additions and 1 deletions

View File

@ -167,8 +167,13 @@ public class ApiServer {
String message = "Failed to create service " + service.getName()
+ ": {}";
LOG.error(message, e);
if (e.getCause().getMessage().contains("already exists")) {
message = "Service name " + service.getName() + " is already taken.";
} else {
message = e.getCause().getMessage();
}
return formatResponse(Status.INTERNAL_SERVER_ERROR,
e.getCause().getMessage());
message);
}
}