title: Signing Out of Firebase in Swift
body: <p>I am attempting to sign out of the Firebase API, but I can't seem to figure out how to handle any errors that may occur.</p>
  
  <p>The Firebase pod provides a method for signing out:</p>
  
  <pre class="lang-swift prettyprint-override"><code>FIRAuth.auth()?.signOut()
  </code></pre>
  
  <p>It is marked with <code>throws</code>, so I have wrapped it in a <code>do</code>/<code>try</code>/<code>catch</code> block in a method to test the signing out process:</p>
  
  <pre class="lang-swift prettyprint-override"><code>do {
      try FIRAuth.auth()?.signOut()
  } catch (let error) {
      print((error as NSError).code)
  }
  </code></pre>
  
  <p>I see that the <code>signOut</code> method is marked with <code>throws</code> in the Firebase pod, but I don't see how it can handle any errors asynchronously. I have tried entering Airplane Mode, which triggers a network error in my code everywhere else that a network request takes place, but with the <code>signOut</code> method, that error isn't caught because I have no completion handler to execute from. All of the other authentication methods from the Firebase pods have a completion handler, in which I am able to handle errors.</p>
  
  <p>Here is the documentation for the <code>signOut</code> method from the Firebase pod:</p>
  
  <pre class="lang-swift prettyprint-override"><code>/** @fn signOut:
      @brief Signs out the current user.
      @param error Optionally; if an error occurs, upon return contains an NSError object that
          describes the problem; is nil otherwise.
      @return @YES when the sign out request was successful. @NO otherwise.
      @remarks Possible error codes:
          - @c FIRAuthErrorCodeKeychainError Indicates an error occurred when accessing the keychain.
              The @c NSLocalizedFailureReasonErrorKey field in the @c NSError.userInfo dictionary
              will contain more information about the error encountered.
   */
  open func signOut() throws
  </code></pre>
  
  <p>Do you have any suggestions for an appropriate way to handle the signing out of a user when I don't have a completion handler that allows me to check for an error?</p>