ExceptionCollector .java

net.minecraft.util.ExceptionCollector (class, 22 lines): members: throwIfPresent, result, add. imports: Nullable.

net.minecraft.utilclass22 linescommonextends Throwable>413 B

API Surface (2)

void add(final T throwable)
void throwIfPresent()

Fields & Constants (1)

result

Full Source

ExceptionCollector.java22 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.util;
2
3
import org.jspecify.annotations.Nullable;
4
5
public class ExceptionCollector<T extends Throwable> {
6
	private @Nullable T result;
7
8
	public void add(final T throwable) {
9
		if (this.result == null) {
10
			this.result = throwable;
11
		} else {
12
			this.result.addSuppressed(throwable);
13
		}
14
	}
15
16
	public void throwIfPresent() throws T {
17
		if (this.result != null) {
18
			throw this.result;
19
		}
20
	}
21
}
22

Decompiled Minecraft 26.3 source of ExceptionCollector (net/minecraft/util/ExceptionCollector.java) with Mojang official mappings, stored verbatim on the site.