Browse Source

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

Billie Rinaldi 7 years ago
parent
commit
598483e496

+ 6 - 1
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/service/webapp/ApiServer.java

@@ -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);
     }
   }