Skip to content

Commit

Permalink
HSEARCH-3388 Add a bit more information to error message when failing…
Browse files Browse the repository at this point in the history
… to parse property strings
  • Loading branch information
yrodiere committed Oct 31, 2018
1 parent 946dfdd commit 2235955
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Expand Up @@ -47,7 +47,7 @@ public static <T> Optional<T> convert(Class<T> expectedType, Function<String, T>
.map( parser );
}
catch (RuntimeException e) {
throw log.invalidPropertyValue( expectedType, e );
throw log.invalidPropertyValue( expectedType, e.getMessage(), e );
}
}

Expand Down
Expand Up @@ -61,8 +61,8 @@ public interface Log extends BasicLogger {
SearchException unableToConvertConfigurationProperty(String key, Object rawValue, String errorMessage, @Cause Exception cause);

@Message(id = ID_OFFSET_2 + 2,
value = "Invalid value: expected either an instance of '%1$s' or a parsable String.")
SearchException invalidPropertyValue(Class<?> expectedType, @Cause Exception cause);
value = "Invalid value: the value is not an instance of '%1$s' and is not a String that can be parsed: %2$s")
SearchException invalidPropertyValue(Class<?> expectedType, String errorMessage, @Cause Exception cause);

@Message(id = ID_OFFSET_2 + 3,
value = "Invalid boolean value: expected either a Boolean, the String 'true' or the String 'false'.")
Expand Down
Expand Up @@ -46,7 +46,8 @@ public void error_invalidReference() {
ANALYSIS_CONFIGURER_ERROR_MESSAGE_PREFIX,
"Unable to convert configuration property 'backend." + BACKEND_NAME
+ "." + SearchBackendElasticsearchSettings.ANALYSIS_CONFIGURER + "'",
"'foobar'"
"'foobar'",
"Unable to find " + ElasticsearchAnalysisConfigurer.class.getName() + " implementation class: foobar"
)
.build()
);
Expand Down
Expand Up @@ -50,7 +50,8 @@ public void error_invalidReference() {
// TODO HSEARCH-3388 expect the full property key instead of just the radical
"Unable to convert configuration property 'backend." + BACKEND_NAME + "."
+ SearchBackendLuceneSettings.ANALYSIS_CONFIGURER + "'",
"'foobar'"
"'foobar'",
"Unable to find " + LuceneAnalysisConfigurer.class.getName() + " implementation class: foobar"
)
.build()
);
Expand Down

0 comments on commit 2235955

Please sign in to comment.