Make missing TR mapping namespace throw an exception instead of printing to stderr

This commit is contained in:
Juuz
2022-05-17 20:44:05 +03:00
parent bc979caff0
commit 4369492b55
3 changed files with 6 additions and 2 deletions

View File

@@ -22,7 +22,7 @@
* SOFTWARE.
*/
package net.fabricmc.loom.util.srg;
package net.fabricmc.loom.util;
/**
* An exception that occurs when processing obfuscation mappings.

View File

@@ -155,7 +155,10 @@ public final class TinyRemapperHelper {
final int toId = mappings.getNamespaceId(to);
if (toId == MappingTreeView.NULL_NAMESPACE_ID) {
System.out.println("Warning: Trying to remap to unknown namespace: " + to);
throw new MappingException(
"Trying to remap from '%s' (id: %d) to unknown namespace '%s'. Available namespaces: [%s -> %s]"
.formatted(from, fromId, to, mappings.getSrcNamespace(), String.join(", ", mappings.getDstNamespaces()))
);
}
for (MappingTree.ClassMapping classDef : mappings.getClasses()) {

View File

@@ -42,6 +42,7 @@ import com.google.common.collect.ListMultimap;
import org.jetbrains.annotations.Nullable;
import net.fabricmc.loom.api.mappings.layered.MappingsNamespace;
import net.fabricmc.loom.util.MappingException;
import net.fabricmc.loom.util.function.CollectionUtil;
import net.fabricmc.mappingio.FlatMappingVisitor;
import net.fabricmc.mappingio.MappingReader;