From c65e346992f9c1a097cb50768ab803b73808fbbe Mon Sep 17 00:00:00 2001 From: grokify Date: Fri, 6 Jul 2018 22:12:33 -0700 Subject: [PATCH] add graceful error for io.airlift.airline.ParseArgumentsUnexpectedException --- .../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);