title: Catching Multiple Errors in Firebase Authentication - Swift
body: <p>I'm working on displaying an error message for my viewers if they provide invalid details to register for my app. Here's the code I'm working with.</p>
  <pre><code>Auth.auth().createUser(withEmail: trimmedEmail, password: trimmedPassword) {[self] authResult, error in
          
          if let err = error as NSError? {
              let errCode = AuthErrorCode(_nsError: err)
              
                switch errCode.code {
                  case .accountExistsWithDifferentCredential, .credentialAlreadyInUse, .emailAlreadyInUse:
                      print(&quot;email alr &quot;)
                  case .weakPassword:
                     print(&quot;weak&quot;)
                  case .networkError:
                      print(&quot;network&quot;)
                  case .invalidEmail
                      print(&quot;invalid email&quot;)
                  default:
                      print(String(reflecting: errCode.code))
                      print(&quot;default&quot;)
              } 
  
              return
          }
      }
  }
  </code></pre>
  <p>The problem is this. If the user types both an invalid email and an invalid password, then I only get an error for invalidEmail, I don't get an error for a weak password. Is there any way I can get multiple errors about both the email and password fields from firebase?</p>