personthecat.catlib.exception.InvalidEnumConstantException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of catlib-quilt Show documentation
Show all versions of catlib-quilt Show documentation
Utilities for serialization, commands, noise generation, IO, and some new data types.
The newest version!
package personthecat.catlib.exception;
import java.util.Arrays;
import static personthecat.catlib.util.Shorthand.f;
public class InvalidEnumConstantException extends RuntimeException {
public InvalidEnumConstantException(final String name, final Class extends Enum>> clazz) {
super(createMessage(name, clazz));
}
private static String createMessage(final String name, final Class extends Enum>> clazz) {
final String values = Arrays.toString(clazz.getEnumConstants());
return f("{} \"{}\" does not exist. Valid options are: {}", clazz.getSimpleName(), name, values);
}
}