aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/NotExistsException.java
blob: 064a2a398607be2ab8524a301b605241e59829b1 (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
// 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;

import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.api.identifiers.Identifier;

/**
 * An exception which indicates that a requested resource does not exist.
 *
 * @author Tony Vaagenes
 */
public class NotExistsException extends IllegalArgumentException {

    public NotExistsException(String message) {
        super(message);
    }

    /**
     * Example message: Tenant 'myId' does not exist.
     *
     * @param capitalizedType e.g. Tenant, Application
     * @param id The id of the entity that didn't exist.
     *
     */
    public NotExistsException(String capitalizedType, String id) {
        super(Text.format("%s '%s' does not exist", capitalizedType, id));
    }

    public NotExistsException(Identifier id) {
        this(id.capitalizedType(), id.id());
    }
    
}