title: Swift 3 - Invalid conversion from throwing function type
body: <p>I'm new to swift and <br>I'm not understanding why I'm getting this error even doing the <code>do catch</code> treatment.<br><br>I've being reading similar questions and so far none of them solved this error :<br> <code>Invalid conversion from throwing function type '(_) throws -&gt; (). to non-throwing function type '([BeaconModel]) -&gt; ()'</code> at the line  <code>BeaconModel.fetchBeaconsFromRestApi(completionHandler: { .....</code></p>
  
  <p>The piece of code with the error:</p>
  
  <pre><code>do{
  
      let path = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
      let db = try Connection("\(path)/db.sqlite3")
  
      let beaconsTbl = Table("beacons")
      let id = Expression&lt;Int64&gt;("id")
      let uuid = Expression&lt;String&gt;("uuid")
      let major = Expression&lt;String&gt;("major")
      let minor = Expression&lt;String&gt;("minor")
  
      try db.run(beaconsTbl.create { t in
          t.column(id, primaryKey: true)
          t.column(uuid)
          t.column(major)
          t.column(minor)
      })
  
      BeaconModel.fetchBeaconsFromRestApi(completionHandler: {
          beacons in
          for item in beacons{
  
              let insert = beaconsTbl.insert(id &lt;- item.id!, uuid &lt;- item.uuid!, major &lt;- item.major!, minor &lt;- item.minor!)
              try db.run(insert)
          }
      })
  
  } catch {
      print("Error creating the database")
  }
  </code></pre>
  
  <p>The fetch method:</p>
  
  <pre><code>static func fetchBeaconsFromRestApi( completionHandler: @escaping (_ beacons: [BeaconModel]) -&gt; ()){
  
      Alamofire.request(Constants.Beacons.URLS.ListAllbeacons).responseArray(keyPath: "data") { (response: DataResponse&lt;[BeaconModel]&gt;) in
  
          let beaconsArray = response.result.value
          if let beaconsArray = beaconsArray {
              completionHandler(beaconsArray)
          }
      }
  }
  </code></pre>
  
  <p>It uses <a href="https://github.com/Alamofire/Alamofire" rel="noreferrer">Alamofire</a> and <a href="https://github.com/tristanhimmelman/AlamofireObjectMapper" rel="noreferrer">AlamofireObjectMapper</a>. Can you see what I'm missing?</p>
  
  <p>Thanks for any help </p>