summaryrefslogtreecommitdiff
path: root/src/main/java/ftbsc/lll/exceptions
diff options
context:
space:
mode:
author zaaarf <zaaarf@proton.me>2023-06-11 14:48:24 +0200
committer zaaarf <zaaarf@proton.me>2023-06-11 14:48:24 +0200
commit7c427316a675cbe7e81a04294781c59f2606239d (patch)
tree3a4efc720f44205db6c518ee854f03eebf215e7c /src/main/java/ftbsc/lll/exceptions
feat: initial implementation, created interface and moved stuff from processor
Diffstat (limited to 'src/main/java/ftbsc/lll/exceptions')
-rw-r--r--src/main/java/ftbsc/lll/exceptions/AmbiguousMappingException.java27
-rw-r--r--src/main/java/ftbsc/lll/exceptions/MappingNotFoundException.java27
2 files changed, 54 insertions, 0 deletions
diff --git a/src/main/java/ftbsc/lll/exceptions/AmbiguousMappingException.java b/src/main/java/ftbsc/lll/exceptions/AmbiguousMappingException.java
new file mode 100644
index 0000000..794759a
--- /dev/null
+++ b/src/main/java/ftbsc/lll/exceptions/AmbiguousMappingException.java
@@ -0,0 +1,27 @@
+package ftbsc.lll.exceptions;
+
+import ftbsc.lll.mapper.IMapper;
+
+/**
+ * Thrown when a given {@link IMapper} cannot uniquely identify a mapping with
+ * the given data.
+ */
+public class AmbiguousMappingException extends RuntimeException {
+
+ /**
+ * Constructs a new ambiguous mapping definition exception with the specified detail message.
+ * @param message the detail message
+ */
+ public AmbiguousMappingException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new ambiguous definition exception with the specified detail message and cause.
+ * @param message the detail message
+ * @param cause the cause, may be null (indicating nonexistent or unknown cause)
+ */
+ public AmbiguousMappingException(String message, Throwable cause) {
+ super(message, cause);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ftbsc/lll/exceptions/MappingNotFoundException.java b/src/main/java/ftbsc/lll/exceptions/MappingNotFoundException.java
new file mode 100644
index 0000000..6c286fc
--- /dev/null
+++ b/src/main/java/ftbsc/lll/exceptions/MappingNotFoundException.java
@@ -0,0 +1,27 @@
+package ftbsc.lll.exceptions;
+
+import ftbsc.lll.mapper.IMapper;
+
+/**
+ * Thrown upon failure to find the requested mapping within a loaded {@link IMapper}.
+ */
+public class MappingNotFoundException extends RuntimeException {
+
+ /**
+ * Constructs a new mapping not found exception for the specified 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);
+ }
+}