22 lines
		
	
	
	
		
			409 B
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
	
		
			409 B
		
	
	
	
		
			Java
		
	
	
	
	
	
| package net.minecraft.util;
 | |
| 
 | |
| import org.jetbrains.annotations.Nullable;
 | |
| 
 | |
| public class ExceptionCollector<T extends Throwable> {
 | |
| 	@Nullable
 | |
| 	private T result;
 | |
| 
 | |
| 	public void add(T exception) {
 | |
| 		if (this.result == null) {
 | |
| 			this.result = exception;
 | |
| 		} else {
 | |
| 			this.result.addSuppressed(exception);
 | |
| 		}
 | |
| 	}
 | |
| 
 | |
| 	public void throwIfPresent() throws T {
 | |
| 		if (this.result != null) {
 | |
| 			throw this.result;
 | |
| 		}
 | |
| 	}
 | |
| }
 |