handleUnresolvablePlaceholder method
Handles what to do when a placeholder cannot be resolved.
If ignoreUnresolvablePlaceholders is true
, returns the unresolved
placeholder in its original placeholder format.
Otherwise, throws a PlaceholderResolutionException.
Implementation
String handleUnresolvablePlaceholder(String key, String text) {
if (ignoreUnresolvablePlaceholders) {
return toPlaceholderText(key);
}
String? originalValue = (!key.equals(text) ? toPlaceholderText(text) : null);
throw PlaceholderResolutionException("Could not resolve placeholder '%s'".formatted(key), key, originalValue);
}