My application is required to display all the empty input errors. I can do it using if-else to store all errors but according to this post, I should using try-catch block to check the required input. How can I practice using try-catch and what is the best practice? Thanks.
A example for creating user. If using if-else, the checking code should be like that
if(isEmpty(inputUserName)){
errorList.add("User name is required");
}
if(isEmpty(inputPassword)){
errorList.add("Password is required");
}
if(isEmpty(inputAnotherRequiredFields)){
errorList.add("Fields is required");
}
....