aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/systemflags/FlagsClientException.java
blob: e1b3da65e6e0a7c86d35c5ee7e739e8dd7da6a29 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.restapi.systemflags;

import java.util.OptionalInt;

/**
 * @author bjorncs
 */
class FlagsClientException extends RuntimeException {

    private final int responseCode;

    FlagsClientException(int responseCode, String message) {
        super(message);
        this.responseCode = responseCode;
    }

    FlagsClientException(String message, Throwable cause) {
        super(message, cause);
        this.responseCode = -1;
    }

    OptionalInt responseCode() {
        return responseCode > 0 ? OptionalInt.of(responseCode) : OptionalInt.empty();
    }
}