adoroszlai commented on code in PR #5049:
URL: https://github.com/apache/ozone/pull/5049#discussion_r1260806939
##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/scm/DecommissionScmSubcommand.java:
##########
@@ -49,10 +49,13 @@ public class DecommissionScmSubcommand extends
ScmSubcommand {
public void execute(ScmClient scmClient) throws IOException {
DecommissionScmResponseProto response = scmClient.decommissionScm(nodeId);
if (!response.getSuccess()) {
- System.out.println("Error decommissioning Scm " + nodeId);
+ String errorMsg = "Error decommissioning Scm " + nodeId;
if (response.hasErrorMsg()) {
- System.out.println(response.getErrorMsg());
+ errorMsg = errorMsg + ", " + response.getErrorMsg();
}
+ System.err.println(errorMsg);
+ // Throwing exception to create non-zero exit code in case of failure.
+ throw new IOException(errorMsg);
Review Comment:
The exception's message is printed to the output, so we don't need to do the
same here.
```
$ ozone admin scm decommission --nodeid=FAKE
Error decommissioning Scm FAKE, ScmId FAKE supplied for scm removal not in
Ratis Peer list
Error decommissioning Scm FAKE, ScmId FAKE supplied for scm removal not in
Ratis Peer list
```
```suggestion
// Throwing exception to create non-zero exit code in case of failure.
throw new IOException(errorMsg);
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]