From: David ‘Bombe’ Roden Date: Tue, 5 May 2015 20:12:29 +0000 (+0200) Subject: Include name of missing option in exception X-Git-Tag: v2~189 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=e6acaaef410946cd247097e6a392e8596c232dba;p=rhynodge.git Include name of missing option in exception --- 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); + } + + } }