Skip to content

Commit

Permalink
- avoid printing exception for help command
Browse files Browse the repository at this point in the history
  • Loading branch information
rathnapandi committed Mar 25, 2024
1 parent 98989c1 commit dab46ff
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void parse() throws AppException {
this.envProperties = new EnvironmentProperties(cmd.getOptionValue("stage"), getValue("apimCLIHome"));
} catch (ParseException e) {
printUsage(e.getMessage(), args);
throw new AppException(e.getMessage(), ErrorCode.UNXPECTED_ERROR, e);
throw new AppException(e.getMessage(), ErrorCode.CLI_PARSING, e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public ErrorCode getError() {
}

public void logException(Logger logger) {
if (error == ErrorCode.SUCCESS)
if (error == ErrorCode.SUCCESS || error == ErrorCode.CLI_PARSING)
return;
Throwable cause = null;
if (error.getPrintStackTrace().booleanValue() || logger.isDebugEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ public enum ErrorCode {

SUCCESS(0, "Replication of the API was successful.", false, LogLevel.INFO),
UNSUPPORTED_API_SPECIFICATION(1, "The API-Specification is not supported by the APIM-CLI.", false),
CLI_PARSING(2, "Error in parsing input parameters", false, LogLevel.INFO),

MISSING_PARAMETER(5, "There is a missing parameter.", false),
INVALID_PARAMETER(6, "There is an invalid parameter.", false),
API_ALREADY_EXISTS(7, "The API already exists for another organization.", false),
Expand Down

0 comments on commit dab46ff

Please sign in to comment.