diff options
author | Harald Musum <musum@yahooinc.com> | 2023-01-13 14:28:45 +0100 |
---|---|---|
committer | Harald Musum <musum@yahooinc.com> | 2023-01-13 14:28:45 +0100 |
commit | 537511f7566889ed5253332eec8eea9ff1d638ac (patch) | |
tree | 144d920f6e114e7f7a371256ceb23ca10b932e14 /config | |
parent | 45bcd747f2affce11d670f4457678be4b0931aea (diff) |
Rethrow exception when building config if file reference does not exist
Diffstat (limited to 'config')
-rw-r--r-- | config/src/main/java/com/yahoo/vespa/config/ConfigPayloadApplier.java | 4 | ||||
-rw-r--r-- | config/src/main/java/com/yahoo/vespa/config/FileReferenceDoesNotExistException.java | 16 |
2 files changed, 18 insertions, 2 deletions
diff --git a/config/src/main/java/com/yahoo/vespa/config/ConfigPayloadApplier.java b/config/src/main/java/com/yahoo/vespa/config/ConfigPayloadApplier.java index 1e90f3974a5..3705c167960 100644 --- a/config/src/main/java/com/yahoo/vespa/config/ConfigPayloadApplier.java +++ b/config/src/main/java/com/yahoo/vespa/config/ConfigPayloadApplier.java @@ -10,7 +10,6 @@ import com.yahoo.slime.ArrayTraverser; import com.yahoo.slime.Inspector; import com.yahoo.slime.ObjectTraverser; import com.yahoo.slime.Type; - import java.io.File; import java.lang.reflect.Constructor; import java.lang.reflect.Field; @@ -21,7 +20,6 @@ import java.nio.file.Path; import java.util.HashMap; import java.util.HashSet; import java.util.Map; -import java.util.Optional; import java.util.Set; import java.util.Stack; import java.util.logging.Logger; @@ -60,6 +58,8 @@ public class ConfigPayloadApplier<T extends ConfigInstance.Builder> { stack.push(new NamedBuilder(rootBuilder)); try { handleValue(payload.getSlime().get()); + } catch (FileReferenceDoesNotExistException e) { + throw e; } catch (Exception e) { throw new RuntimeException("Not able to create config builder for payload '" + payload.toString() + "'", e); } diff --git a/config/src/main/java/com/yahoo/vespa/config/FileReferenceDoesNotExistException.java b/config/src/main/java/com/yahoo/vespa/config/FileReferenceDoesNotExistException.java new file mode 100644 index 00000000000..b8767e6deb1 --- /dev/null +++ b/config/src/main/java/com/yahoo/vespa/config/FileReferenceDoesNotExistException.java @@ -0,0 +1,16 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.config; + +/** + * @author Tony Vaagenes + */ +public class FileReferenceDoesNotExistException extends RuntimeException { + + public final String fileReference; + + public FileReferenceDoesNotExistException(String fileReference) { + super("Could not retrieve file with file reference '" + fileReference + "'"); + this.fileReference = fileReference; + } + +} |