title: Reading Firebase Auth Error Thrown (Firebase 3.x and Swift)
body: <p>I'm having trouble figuring out how to read the FIRAuthErrorNameKey in the new version of Firebase.  The following is what I have so far, but the "let errorCode = FIRAuthErrorNameKey" line is incorrect.  From reading the <a href="https://firebase.google.com/docs/auth/ios/errors" rel="noreferrer">Firebase documentation</a> I also tried accessing the error code from the userInfo, but was unsuccessful and am out of ideas.</p>
  
  <pre><code> // Send request to Firebase to add user to register user
   FIRAuth.auth()?.createUserWithEmail(emailTextField.text!, password: passwordTextField.text!, completion: { (user, error) in
  
          // Check for errors and respond to user accordingly.
          if error != nil {
  
              let errorCode = FIRAuthErrorNameKey
  
              switch errorCode {
  
              case "FIRAuthErrorCodeEmailAlreadyInUse":
  
                  // Add logic accordingly
  
              case ...:
  
                 // Add logic accordingly
  
              case default:
  
                // Add logic accordingly
              }
          }
   })
  </code></pre>