GOTO
statements and make the code harder to read.try
{
_authenticationService.LogUserIn(username, password);
}
catch (InvalidCredentialsException)
{
// show "Invalid credentials" message
}
var authResult = _authenticationService.LogUserIn(username, password);
// instead of using an exception to indicate (expected) failure, we use a control statement
if (!authResult.IsAuthenticated)
{
// show "Invalid credentials" message
}