diff options
author | Arne Juul <arnej@yahooinc.com> | 2023-03-23 09:41:45 +0000 |
---|---|---|
committer | Arne Juul <arnej@yahooinc.com> | 2023-03-23 09:41:45 +0000 |
commit | 64dac2f27014d8731814d6179085694d5aa9a11f (patch) | |
tree | 8d81be9481f3e8e9d6d91a53a48cb41e789a25bd /config-model | |
parent | a9a6d2275c49f5690791cbb50648589ea800a146 (diff) |
improve error for cycle in ranking expression functions
Diffstat (limited to 'config-model')
-rw-r--r-- | config-model/src/main/java/com/yahoo/schema/derived/DerivedConfiguration.java | 4 | ||||
-rw-r--r-- | config-model/src/main/java/com/yahoo/schema/derived/RankProfileList.java | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/config-model/src/main/java/com/yahoo/schema/derived/DerivedConfiguration.java b/config-model/src/main/java/com/yahoo/schema/derived/DerivedConfiguration.java index 8b07aa48a24..9d10047288b 100644 --- a/config-model/src/main/java/com/yahoo/schema/derived/DerivedConfiguration.java +++ b/config-model/src/main/java/com/yahoo/schema/derived/DerivedConfiguration.java @@ -88,8 +88,8 @@ public class DerivedConfiguration implements AttributesConfig.Producer { } Validation.validate(this, schema); } - catch (IllegalArgumentException e) { - throw new IllegalArgumentException("Invalid " + schema, e); + catch (IllegalArgumentException|IllegalStateException e) { + throw new IllegalArgumentException("Invalid " + schema + " -> " + e.getMessage(), e); } } diff --git a/config-model/src/main/java/com/yahoo/schema/derived/RankProfileList.java b/config-model/src/main/java/com/yahoo/schema/derived/RankProfileList.java index a50ddd4aeea..ac7495d09c7 100644 --- a/config-model/src/main/java/com/yahoo/schema/derived/RankProfileList.java +++ b/config-model/src/main/java/com/yahoo/schema/derived/RankProfileList.java @@ -127,8 +127,9 @@ public class RankProfileList extends Derived implements RankProfilesConfig.Produ throw new IllegalStateException(e); } catch (ExecutionException e) { - throw e.getCause() instanceof IllegalArgumentException ? (IllegalArgumentException)e.getCause() - : new IllegalStateException(e); + if (e.getCause() instanceof IllegalArgumentException iArg) throw iArg; + if (e.getCause() instanceof IllegalStateException iState) throw iState; + throw new IllegalStateException(e); } } |