Skip to content

Commit b1edafe

Browse files
committed
Log exception when KeyValueDelegate.getMountInfo(…) fails.
Closes gh-888
1 parent 7d19a76 commit b1edafe

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

spring-vault-core/src/main/java/org/springframework/vault/core/util/KeyValueDelegate.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
import java.util.Map;
2121
import java.util.function.Supplier;
2222

23+
import org.apache.commons.logging.Log;
24+
import org.apache.commons.logging.LogFactory;
25+
2326
import org.springframework.lang.Nullable;
2427
import org.springframework.util.ConcurrentReferenceHashMap;
2528
import org.springframework.util.StringUtils;
@@ -40,6 +43,8 @@
4043
*/
4144
public class KeyValueDelegate {
4245

46+
private static final Log logger = LogFactory.getLog(KeyValueDelegate.class);
47+
4348
private final Map<String, MountInfo> mountInfo;
4449

4550
private final VaultOperations operations;
@@ -125,13 +130,20 @@ public MountInfo getMountInfo(String path) {
125130

126131
if (mountInfo == null) {
127132
try {
128-
129133
mountInfo = doGetMountInfo(path);
130134
}
131135
catch (VaultException e) {
136+
if (logger.isDebugEnabled()) {
137+
logger.debug("Unable to determine mount information for [%s]. Returning unavailable MountInfo: %s"
138+
.formatted(path, e.getMessage()), e);
139+
}
132140
return MountInfo.unavailable();
133141
}
134142
catch (RuntimeException e) {
143+
if (logger.isDebugEnabled()) {
144+
logger.debug("Unable to determine mount information for [%s]. Caching unavailable MountInfo: %s"
145+
.formatted(path, e.getMessage()), e);
146+
}
135147
mountInfo = MountInfo.unavailable();
136148
}
137149

0 commit comments

Comments
 (0)