mirror of
https://github.com/lightbend/config.git
synced 2025-03-23 07:40:25 +08:00
Merge pull request #585 from ensirius/master
#584 Add root config origin to exception
This commit is contained in:
commit
2a103fe53f
@ -126,6 +126,10 @@ public abstract class ConfigException extends RuntimeException implements Serial
|
||||
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 @@ public abstract class ConfigException extends RuntimeException implements Serial
|
||||
super(origin, message, cause);
|
||||
}
|
||||
|
||||
protected Missing(ConfigOrigin origin, String message) {
|
||||
this(origin, message, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -153,7 +153,7 @@ final class SimpleConfig implements Config, MergeableValue, Serializable {
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user