summaryrefslogtreecommitdiff
path: root/src/main/java/ftbsc/lll/exceptions
diff options
context:
space:
mode:
author zaaarf <zaaarf@proton.me>2023-03-13 13:03:49 +0100
committer zaaarf <zaaarf@proton.me>2023-03-13 13:03:49 +0100
commit6e2ea19ab48987e01543b6db188f8e5ce3d1eeb9 (patch)
tree4c3970735dd7fa82d4358eb3b744a7d2de21755c /src/main/java/ftbsc/lll/exceptions
parentdf3590d097e28309f7ed2dc3cc3d8413a9f56b49 (diff)
feat: may now pass local files as mappings
Diffstat (limited to 'src/main/java/ftbsc/lll/exceptions')
-rw-r--r--src/main/java/ftbsc/lll/exceptions/InvalidResourceException.java22
-rw-r--r--src/main/java/ftbsc/lll/exceptions/MappingNotFoundException.java16
2 files changed, 35 insertions, 3 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..dd75a08
--- /dev/null
+++ b/src/main/java/ftbsc/lll/exceptions/InvalidResourceException.java
@@ -0,0 +1,22 @@
+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 is empty.
+ */
+ public InvalidResourceException() {
+ super("The specified resource was empty!");
+ }
+
+ /**
+ * Named constructor, used when the specified resource doesn't exist.
+ * @param name the resource name
+ */
+ public InvalidResourceException(String name) {
+ super("Specified resource " + name + " was not found!");
+ }
+}
diff --git a/src/main/java/ftbsc/lll/exceptions/MappingNotFoundException.java b/src/main/java/ftbsc/lll/exceptions/MappingNotFoundException.java
index a1a47d1..3334242 100644
--- a/src/main/java/ftbsc/lll/exceptions/MappingNotFoundException.java
+++ b/src/main/java/ftbsc/lll/exceptions/MappingNotFoundException.java
@@ -1,17 +1,27 @@
package ftbsc.lll.exceptions;
-import ftbsc.lll.processor.tools.obfuscation.ObfuscationMapper;
+import ftbsc.lll.processor.tools.obfuscation.IMapper;
/**
- * Thrown upon failure to find the requested mapping within a loaded {@link ObfuscationMapper}.
+ * 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 detail message
+ * @param mapping the relevant mapping
*/
public MappingNotFoundException(String mapping) {
super("Could not find mapping for " + 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);
+ }
}