aboutsummaryrefslogtreecommitdiffstats
path: root/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/client/zms/ZmsClientException.java
blob: 0c2f80dba2ccb6bc201027176724fa31f432539a (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.athenz.client.zms;

/**
 * An exception that can be thrown by {@link ZmsClient} implementations.
 *
 * @author bjorncs
 */
public class ZmsClientException extends RuntimeException {

    private final int errorCode;
    private final String description;

    public ZmsClientException(int errorCode, String description) {
        super(createMessage(errorCode, description));
        this.errorCode = errorCode;
        this.description = description;
    }

    public int getErrorCode() {
        return errorCode;
    }

    public String getDescription() {
        return description;
    }

    private static String createMessage(int code, String description) {
        return String.format("Received error from ZMS: code=%d, message=\"%s\"", code, description);
    }

}