aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/NotExistsException.java
diff options
context:
space:
mode:
authorMartin Polden <martin.polden@gmail.com>2017-08-22 13:33:30 +0200
committerMartin Polden <martin.polden@gmail.com>2017-08-24 12:45:09 +0200
commit56b9aae782b782066d7e9603fce9095aa5cafd30 (patch)
tree8f4d1a590e3745737bf60b0b47ead54d186e5821 /controller-server/src/main/java/com/yahoo/vespa/hosted/controller/NotExistsException.java
parent08c2a0490261a4666b65882616756ecfbe1c8c9b (diff)
Import controller
Diffstat (limited to 'controller-server/src/main/java/com/yahoo/vespa/hosted/controller/NotExistsException.java')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/NotExistsException.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/NotExistsException.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/NotExistsException.java
new file mode 100644
index 00000000000..6a47957f27f
--- /dev/null
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/NotExistsException.java
@@ -0,0 +1,32 @@
+// Copyright 2017 Yahoo Holdings. 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.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(String.format("%s '%s' does not exist", capitalizedType, id));
+ }
+
+ public NotExistsException(Identifier id) {
+ this(id.capitalizedType(), id.id());
+ }
+
+}