From a0f5f5d54ec67fd3f5a30c23794534e4fe7bac6c Mon Sep 17 00:00:00 2001 From: John Wang Date: Sun, 8 Jul 2018 08:00:22 -0700 Subject: [PATCH] add graceful error for io.airlift.airline.ParseArgumentsUnexpectedException (#494) --- .../main/java/org/openapitools/codegen/OpenAPIGenerator.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/OpenAPIGenerator.java b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/OpenAPIGenerator.java index 105320166095..305bb9a41196 100644 --- a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/OpenAPIGenerator.java +++ b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/OpenAPIGenerator.java @@ -19,6 +19,7 @@ import io.airlift.airline.Cli; import io.airlift.airline.Help; +import io.airlift.airline.ParseArgumentsUnexpectedException; import io.airlift.airline.ParseOptionMissingException; import io.airlift.airline.ParseOptionMissingValueException; import org.openapitools.codegen.cmd.*; @@ -67,6 +68,9 @@ public static void main(String[] args) { if (args.length == 0) { System.exit(1); } + } catch (ParseArgumentsUnexpectedException e) { + System.err.printf("[error] %s%n%nSee 'openapi-generator-cli help' for usage.%n", e.getMessage()); + System.exit(1); } catch (ParseOptionMissingException | ParseOptionMissingValueException e) { System.err.printf("[error] %s%n", e.getMessage()); System.exit(1);