I am coding in java since long, However I am confused in Exception Handling. I have to check the valid user.
One way is the if the user is not in db throw no user found exception and then catch the exception and then show the message to the client.
Another way is to check whether the user is in db with if condition and then respond back with message.. Instead of exception
which one is better and why? When to use If and when to catch an exception