From e6acaaef410946cd247097e6a392e8596c232dba Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 5 May 2015 22:12:29 +0200 Subject: [PATCH] Include name of missing option in exception --- src/main/java/net/pterodactylus/util/envopt/Parser.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/pterodactylus/util/envopt/Parser.java b/src/main/java/net/pterodactylus/util/envopt/Parser.java index 208d6f4..bc2d986 100644 --- a/src/main/java/net/pterodactylus/util/envopt/Parser.java +++ b/src/main/java/net/pterodactylus/util/envopt/Parser.java @@ -29,7 +29,7 @@ public class Parser { String variableName = option.name(); Optional value = environment.getValue(variableName); if (option.required() && !value.isPresent()) { - throw new RequiredOptionIsMissing(); + throw new RequiredOptionIsMissing(option.name()); } field.setAccessible(true); try { @@ -46,6 +46,12 @@ public class Parser { return new Parser(new SystemEnvironment()); } - public static class RequiredOptionIsMissing extends RuntimeException { } + public static class RequiredOptionIsMissing extends RuntimeException { + + public RequiredOptionIsMissing(String message) { + super(message); + } + + } } -- 2.7.4