diff --git a/src/main/java/net/patchworkmc/manifest/accesstransformer/AccessTransformerEntry.java b/src/main/java/net/patchworkmc/manifest/accesstransformer/AccessTransformerEntry.java index 486bfd2..76c49ba 100644 --- a/src/main/java/net/patchworkmc/manifest/accesstransformer/AccessTransformerEntry.java +++ b/src/main/java/net/patchworkmc/manifest/accesstransformer/AccessTransformerEntry.java @@ -3,7 +3,7 @@ import java.util.Objects; import net.patchworkmc.manifest.accesstransformer.v2.ForgeAccessTransformer; -import net.patchworkmc.manifest.accesstransformer.v2.exception.FatalRemappingException; +import net.patchworkmc.manifest.accesstransformer.v2.exception.FatalMissingMappingException; import net.patchworkmc.manifest.accesstransformer.v2.exception.MissingMappingException; import net.patchworkmc.manifest.api.Remapper; @@ -46,7 +46,7 @@ public AccessTransformerEntry remap(Remapper remapper) { this.memberName = mappedMemberName; return this; } catch (MissingMappingException ex) { - throw new FatalRemappingException(ex); + throw new FatalMissingMappingException(ex); } } diff --git a/src/main/java/net/patchworkmc/manifest/accesstransformer/v2/exception/FatalMissingMappingException.java b/src/main/java/net/patchworkmc/manifest/accesstransformer/v2/exception/FatalMissingMappingException.java new file mode 100644 index 0000000..23faa1b --- /dev/null +++ b/src/main/java/net/patchworkmc/manifest/accesstransformer/v2/exception/FatalMissingMappingException.java @@ -0,0 +1,25 @@ +package net.patchworkmc.manifest.accesstransformer.v2.exception; + +public class FatalMissingMappingException extends RuntimeException { + public FatalMissingMappingException(String message, MissingMappingException parent) { + super(message, parent); + } + + public FatalMissingMappingException(MissingMappingException parent) { + super(parent); + } + + @Override + public synchronized MissingMappingException getCause() { + return (MissingMappingException) super.getCause(); + } + + @Override + public synchronized Throwable initCause(Throwable cause) { + if (!(cause instanceof MissingMappingException)) { + throw new IllegalArgumentException("Cause must be an instance of MissingMappingException!"); + } + + return super.initCause(cause); + } +} diff --git a/src/main/java/net/patchworkmc/manifest/accesstransformer/v2/exception/FatalRemappingException.java b/src/main/java/net/patchworkmc/manifest/accesstransformer/v2/exception/FatalRemappingException.java deleted file mode 100644 index e395951..0000000 --- a/src/main/java/net/patchworkmc/manifest/accesstransformer/v2/exception/FatalRemappingException.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.patchworkmc.manifest.accesstransformer.v2.exception; - -public class FatalRemappingException extends RuntimeException { - public FatalRemappingException(String message, Exception parent) { - super(message, parent); - } - - public FatalRemappingException(Exception parent) { - super(parent); - } -}