diff options
Diffstat (limited to 'vespa-feed-client-api/src/main/java/ai/vespa/feed/client/FeedException.java')
-rw-r--r-- | vespa-feed-client-api/src/main/java/ai/vespa/feed/client/FeedException.java | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/vespa-feed-client-api/src/main/java/ai/vespa/feed/client/FeedException.java b/vespa-feed-client-api/src/main/java/ai/vespa/feed/client/FeedException.java new file mode 100644 index 00000000000..1936eb09418 --- /dev/null +++ b/vespa-feed-client-api/src/main/java/ai/vespa/feed/client/FeedException.java @@ -0,0 +1,47 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package ai.vespa.feed.client; + +import java.util.Optional; + +/** + * Signals that an error occurred during feeding + * + * @author bjorncs + */ +public class FeedException extends RuntimeException { + + private final DocumentId documentId; + + public FeedException(String message) { + super(message); + this.documentId = null; + } + + public FeedException(DocumentId documentId, String message) { + super(message); + this.documentId = documentId; + } + + public FeedException(String message, Throwable cause) { + super(message, cause); + this.documentId = null; + } + + public FeedException(Throwable cause) { + super(cause); + this.documentId = null; + } + + public FeedException(DocumentId documentId, Throwable cause) { + super(cause); + this.documentId = documentId; + } + + public FeedException(DocumentId documentId, String message, Throwable cause) { + super(message, cause); + this.documentId = documentId; + } + + public Optional<DocumentId> documentId() { return Optional.ofNullable(documentId); } + +} |