title: Swift throw from closure nested in a function
body: <p>I have a function that throws an error, in this function I have a <code>inside a</code> closure that I need to throw the error from it's completion handler. Is that possible ?</p>
  
  <p>Here is my code so far.</p>
  
  <pre><code>enum CalendarEventError: ErrorType {
      case UnAuthorized
      case AccessDenied
      case Failed
  }
  
  func insertEventToDefaultCalendar(event :EKEvent) throws {
      let eventStore = EKEventStore()
      switch EKEventStore.authorizationStatusForEntityType(.Event) {
      case .Authorized:
          do {
              try insertEvent(eventStore, event: event)
          } catch {
              throw CalendarEventError.Failed
          }
  
      case .Denied:
          throw CalendarEventError.AccessDenied
  
      case .NotDetermined:
          eventStore.requestAccessToEntityType(EKEntityType.Event, completion: { (granted, error) -&gt; Void in
              if granted {
                  //insertEvent(eventStore)
              } else {
                  //throw CalendarEventError.AccessDenied
              }
          })
      default:
      }
  }
  </code></pre>