Skip to content

Commit

Permalink
Merge pull request #585 from ensirius/master
Browse files Browse the repository at this point in the history
#584 Add root config origin to exception
  • Loading branch information
havocp authored Sep 7, 2018
2 parents 40d0c40 + 743f240 commit 2a103fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions config/src/main/java/com/typesafe/config/ConfigException.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2a103fe

Please sign in to comment.