valepakh commented on code in PR #1812:
URL: https://github.com/apache/ignite-3/pull/1812#discussion_r1143306597


##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/node/metric/NodeMetricDisableCommand.java:
##########
@@ -48,6 +49,7 @@ public Integer call() {
                 .output(spec.commandLine().getOut())
                 .errOutput(spec.commandLine().getErr())
                 .verbose(verbose)
+                .exceptionHandler(new 
ClusterNotInitializedExceptionHandler("Cannot disable metrics", "cluster init"))

Review Comment:
   ```suggestion
                   .exceptionHandler(new 
ClusterNotInitializedExceptionHandler("Cannot disable metrics", "ignite cluster 
init"))
   ```



##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/call/unit/DeployUnitCall.java:
##########
@@ -89,6 +89,10 @@ private static CallOutput<String> handleException(Exception 
exception, DeployUni
         if (exception instanceof ApiException) {
             ApiException apiException = (ApiException) exception;
             if (apiException.getCode() == 409) {
+                // special case when cluster is not initialized
+                if (((ApiException) 
exception).getResponseBody().contains("Cluster is not initialized")) {

Review Comment:
   ```suggestion
                   if (apiException.getResponseBody().contains("Cluster is not 
initialized")) {
   ```



##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/node/metric/NodeMetricEnableCommand.java:
##########
@@ -48,6 +49,7 @@ public Integer call() {
                 .output(spec.commandLine().getOut())
                 .errOutput(spec.commandLine().getErr())
                 .verbose(verbose)
+                .exceptionHandler(new 
ClusterNotInitializedExceptionHandler("Cannot enable metrics", "cluster init"))

Review Comment:
   ```suggestion
                   .exceptionHandler(new 
ClusterNotInitializedExceptionHandler("Cannot enable metrics", "ignite cluster 
init"))
   ```



##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/unit/UnitDeployCommand.java:
##########
@@ -72,6 +73,7 @@ public Integer call() throws Exception {
                 .output(spec.commandLine().getOut())
                 .errOutput(spec.commandLine().getErr())
                 .verbose(verbose)
+                .exceptionHandler(new 
ClusterNotInitializedExceptionHandler("Cannot deploy unit", "cluster init"))

Review Comment:
   We should rewrite the UnitCommand to use `askQuestionIfNotConnected` and 
change this handler accordingly for non-REPL commands. Since there are a lot of 
them we might want to extract this to a pair of construction methods? Also 
since we renamed the CLI executable to `ignite3` we might want to do that now 
and then change the string accordingly.



##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/node/metric/NodeMetricListCommand.java:
##########
@@ -47,6 +48,7 @@ public Integer call() {
                 .errOutput(spec.commandLine().getErr())
                 .decorator(new MetricListDecorator())
                 .verbose(verbose)
+                .exceptionHandler(new 
ClusterNotInitializedExceptionHandler("Cannot list metrics", "cluster init"))

Review Comment:
   ```suggestion
                   .exceptionHandler(new 
ClusterNotInitializedExceptionHandler("Cannot list metrics", "ignite cluster 
init"))
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to