Rework isValidCredentials to avoid empty catch