mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-01 08:29:09 +00:00
fix more excpption useage
This commit is contained in:
parent
9cf2f42d15
commit
32881c08b3
@ -120,6 +120,8 @@ public class Setting<T> extends ToXContentToBytes {
|
|||||||
return parser.apply(value);
|
return parser.apply(value);
|
||||||
} catch (ElasticsearchParseException ex) {
|
} catch (ElasticsearchParseException ex) {
|
||||||
throw new IllegalArgumentException(ex.getMessage(), ex);
|
throw new IllegalArgumentException(ex.getMessage(), ex);
|
||||||
|
} catch (NumberFormatException ex) {
|
||||||
|
throw new IllegalArgumentException("Failed to parse value [" + value + "] for setting [" + getKey() + "]", ex);
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
throw ex;
|
throw ex;
|
||||||
} catch (Exception t) {
|
} catch (Exception t) {
|
||||||
|
@ -91,6 +91,7 @@ public class SettingsUpdaterTests extends ESTestCase {
|
|||||||
Settings.builder().put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), "not a float").put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), 1.0f).build());
|
Settings.builder().put(BalancedShardsAllocator.INDEX_BALANCE_FACTOR_SETTING.getKey(), "not a float").put(BalancedShardsAllocator.SHARD_BALANCE_FACTOR_SETTING.getKey(), 1.0f).build());
|
||||||
fail("all or nothing");
|
fail("all or nothing");
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
|
logger.info("", ex);
|
||||||
assertEquals("Failed to parse value [not a float] for setting [cluster.routing.allocation.balance.index]", ex.getMessage());
|
assertEquals("Failed to parse value [not a float] for setting [cluster.routing.allocation.balance.index]", ex.getMessage());
|
||||||
}
|
}
|
||||||
assertNull("updater only does a dryRun", index.get());
|
assertNull("updater only does a dryRun", index.get());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user