aboutsummaryrefslogtreecommitdiffstats
path: root/vespa-feed-client-api/src/main/java/ai/vespa/feed/client/FeedException.java
blob: 1936eb094185fd6bb237753cb75fca98402cc897 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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); }

}