diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-05-13 10:03:24 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-05-13 10:03:24 +0200 |
commit | 31a2c57d196a8fe5f23a8f2a753940d165e0201b (patch) | |
tree | 6d0f1dacc320737d3c6e6f6383c30ca6e17cc637 /config-model/src/main/java/com/yahoo | |
parent | 1ac0e7b95b48ea75a1796856ea8e8ebac04f6b8d (diff) |
Better error messages
Diffstat (limited to 'config-model/src/main/java/com/yahoo')
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/application/validation/ConstantValidator.java | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/ConstantValidator.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/ConstantValidator.java index 0f87effcc82..a0fb7078b13 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/ConstantValidator.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/ConstantValidator.java @@ -34,7 +34,7 @@ public class ConstantValidator extends Validator { } if (exceptionMessageCollector.exceptionsOccurred) - throw new TensorValidationException(exceptionMessageCollector.combinedMessage); + throw new IllegalArgumentException(exceptionMessageCollector.combinedMessage); } private void validate(RankProfile.Constant constant, @@ -42,8 +42,8 @@ public class ConstantValidator extends Validator { ExceptionMessageCollector exceptionMessageCollector) { try { validate(constant, applicationPackage); - } catch (InvalidConstantTensorException | FileNotFoundException ex) { - exceptionMessageCollector.add(ex, constant.name().toString(), constant.valuePath().get()); + } catch (InvalidConstantTensorException | FileNotFoundException exception) { + exceptionMessageCollector.add(constant, exception); } } @@ -73,16 +73,10 @@ public class ConstantValidator extends Validator { this.combinedMessage = messagePrelude; } - public ExceptionMessageCollector add(Throwable throwable, String rcName, String rcFilename) { + public void add(RankProfile.Constant constant, Exception exception) { exceptionsOccurred = true; - combinedMessage += String.format("\nRanking constant '%s' (%s): %s", rcName, rcFilename, throwable.getMessage()); - return this; - } - } - - static class TensorValidationException extends IllegalArgumentException { - TensorValidationException(String message) { - super(message); + combinedMessage += "\n" + constant.name() + " " + constant.type() + ": file:" + constant.valuePath().get() + + ": " + exception.getMessage(); } } |