summaryrefslogtreecommitdiff
path: root/src/main/java/ftbsc/lll/exceptions
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/ftbsc/lll/exceptions')
-rw-r--r--src/main/java/ftbsc/lll/exceptions/InvalidResourceException.java23
-rw-r--r--src/main/java/ftbsc/lll/exceptions/MalformedMappingsException.java7
-rw-r--r--src/main/java/ftbsc/lll/exceptions/MappingNotFoundException.java15
3 files changed, 33 insertions, 12 deletions
diff --git a/src/main/java/ftbsc/lll/exceptions/InvalidResourceException.java b/src/main/java/ftbsc/lll/exceptions/InvalidResourceException.java
new file mode 100644
index 0000000..060d57c
--- /dev/null
+++ b/src/main/java/ftbsc/lll/exceptions/InvalidResourceException.java
@@ -0,0 +1,23 @@
+package ftbsc.lll.exceptions;
+
+/**
+ * Thrown when a resource passed as an argument is not found.
+ */
+public class InvalidResourceException extends RuntimeException {
+
+ /**
+ * Empty constructor, used when the provided resource exists but no
+ * mapper was able to read it.
+ */
+ public InvalidResourceException() {
+ super("The given resource was not claimed by any mapper!");
+ }
+
+ /**
+ * Named constructor, used when the specified resource doesn't exist.
+ * @param name the resource name
+ */
+ public InvalidResourceException(String name) {
+ super(String.format("Specified resource %s was not found!", name));
+ }
+}
diff --git a/src/main/java/ftbsc/lll/exceptions/MalformedMappingsException.java b/src/main/java/ftbsc/lll/exceptions/MalformedMappingsException.java
new file mode 100644
index 0000000..1352855
--- /dev/null
+++ b/src/main/java/ftbsc/lll/exceptions/MalformedMappingsException.java
@@ -0,0 +1,7 @@
+package ftbsc.lll.exceptions;
+
+public class MalformedMappingsException extends Exception {
+ public MalformedMappingsException(String mapping, String type) {
+ super(String.format("Unexpected token at line %s for mapper type %s!", mapping, type));
+ }
+}
diff --git a/src/main/java/ftbsc/lll/exceptions/MappingNotFoundException.java b/src/main/java/ftbsc/lll/exceptions/MappingNotFoundException.java
index 6c286fc..85ac08f 100644
--- a/src/main/java/ftbsc/lll/exceptions/MappingNotFoundException.java
+++ b/src/main/java/ftbsc/lll/exceptions/MappingNotFoundException.java
@@ -9,19 +9,10 @@ public class MappingNotFoundException extends RuntimeException {
/**
* Constructs a new mapping not found exception for the specified mapping.
+ * @param type the type of mapping
* @param mapping the relevant mapping
*/
- public MappingNotFoundException(String mapping) {
- super(String.format("Could not find mapping for %s!", mapping));
- }
-
- /**
- * Constructs a new mapping not found exception for the specified mapping
- * with the specified reason.
- * @param mapping the relevant mapping
- * @param reason the reason message
- */
- public MappingNotFoundException(String mapping, String reason) {
- this(mapping + ": " + reason);
+ public MappingNotFoundException(String type, String mapping) {
+ super(String.format("Could not find mapping for %s %s!", type, mapping));
}
}