title: Swift 2.0 url post request
body: <p>I've been trying to figure out what is wrong whit my code but i keep getting this error in swift 2.0</p>
  
  <pre><code>Errors thrown from here are not handled because the enclosing catch is not exhaustive
  </code></pre>
  
  <p>The automated conversion from XCode did a lot of work for me (also gave a LOT of errors) but this is still not working. I don't understand what is working so maybe you guys can throw some light on the case. Thanks in advance</p>
  
  <p>here is my code</p>
  
  <pre><code>if config.isConnected() {
          let post:NSString = "postID=\(postID)"
          //NSLog("PostData: %@",post);
          let url:NSURL = NSURL(string:"https://www.example.com/json/index.php")!
          let postData:NSData = post.dataUsingEncoding(NSASCIIStringEncoding)!
          let postLength:NSString = String( postData.length )
  
          let request:NSMutableURLRequest = NSMutableURLRequest(URL: url)
          request.HTTPMethod = "POST"
          request.HTTPBody = postData
          request.setValue(postLength as String, forHTTPHeaderField: "Content-Length")
          request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
          request.setValue("application/json", forHTTPHeaderField: "Accept")
  
          var reponseError: NSError?
          var response: NSURLResponse?
  
          var urlData: NSData?
          do {
              urlData = try NSURLConnection.sendSynchronousRequest(request, returningResponse:&amp;response) // gives error
          } catch let error as NSError {
              print(reponseError)
              reponseError = error
              urlData = nil
          }
          if ( urlData != nil ) {
              Webiew.loadRequest(request)
          } else {
              let alert: UIAlertView = UIAlertView(title: "OOPS", message: "There is nothing here!", delegate: nil, cancelButtonTitle: "OK");
              alert.show()
          }
      } else { 
          // not connected 
      }
  </code></pre>