サンプル用に、検証の種類ごとに特殊な例外を作成する必要があります。
public void doSomething(Text text) {
if (!text.isAlphaNumeric()) throw new NonAlphaNumericException("Text should be alphanumeric");
if (text.isBlank()) throw new BlankException("Text should not be empty or null");
...
}
または、次のような一般的な例外を行う必要があります。
public void doSomething(Text text) {
if (!text.isAlphaNumeric()) throw new TextValidationException("Text should be alphanumeric");
if (text.isBlank()) throw new TextValidationException("Text should not be empty or null");
...
}