aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/NotExistsException.java
diff options
context:
space:
mode:
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());
+ }
+
+}