aboutsummaryrefslogtreecommitdiffstats
path: root/vespa-feed-client-api/src/main/java/ai/vespa/feed/client/ResultException.java
blob: 27803898c01791605263e584c38e8490f1c9c5fd (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.feed.client;

import ai.vespa.feed.client.DocumentId;
import ai.vespa.feed.client.FeedException;
import ai.vespa.feed.client.OperationParameters;

import java.util.Optional;

/**
 * Signals that the document API in the feed container returned a failure result for a feed operation.
 *
 * @author jonmv
 */
public class ResultException extends FeedException {

    private final String trace;

    public ResultException(DocumentId documentId, String message, String trace) {
        super(documentId, message);
        this.trace = trace;
    }

    /** Holds the trace, if the failed operation had a {@link OperationParameters#tracelevel(int)} higher than 0. */
    public Optional<String> getTrace() {
        return Optional.ofNullable(trace);
    }

}