diff --git a/config/src/main/java/com/typesafe/config/ConfigException.java b/config/src/main/java/com/typesafe/config/ConfigException.java index fce04b407..f35e8dbea 100644 --- a/config/src/main/java/com/typesafe/config/ConfigException.java +++ b/config/src/main/java/com/typesafe/config/ConfigException.java @@ -126,6 +126,10 @@ public Missing(String path, Throwable cause) { cause); } + public Missing(ConfigOrigin origin, String path) { + this(origin, "No configuration setting found for key '" + path + "'", null); + } + public Missing(String path) { this(path, null); } @@ -134,9 +138,6 @@ protected Missing(ConfigOrigin origin, String message, Throwable cause) { super(origin, message, cause); } - protected Missing(ConfigOrigin origin, String message) { - this(origin, message, null); - } } /** diff --git a/config/src/main/java/com/typesafe/config/impl/SimpleConfig.java b/config/src/main/java/com/typesafe/config/impl/SimpleConfig.java index ce1913adb..c0d6b65c7 100644 --- a/config/src/main/java/com/typesafe/config/impl/SimpleConfig.java +++ b/config/src/main/java/com/typesafe/config/impl/SimpleConfig.java @@ -153,7 +153,7 @@ static private AbstractConfigValue findKeyOrNull(AbstractConfigObject self, Stri ConfigValueType expected, Path originalPath) { AbstractConfigValue v = self.peekAssumingResolved(key, originalPath); if (v == null) - throw new ConfigException.Missing(originalPath.render()); + throw new ConfigException.Missing(self.origin(), originalPath.render()); if (expected != null) v = DefaultTransformer.transform(v, expected);