 
     private func close() throws {
         guard self.connected else {
-            try failWithError(); return
+            throw failWithError()
         }
 
         PQfinish(conn)
         conn = nil
     }
 
-    private func failWithError(_ conn: OpaquePointer? = nil) throws {
+    private func failWithError(_ conn: OpaquePointer? = nil) -> Error {
         let message = String(cString: PQerrorMessage(conn ?? self.conn))
-        throw RopeError.connectionFailed(message: message)
+        return RopeError.connectionFailed(message: message)
     }
 }

            values[idx] = UnsafePointer<Int8>(OpaquePointer(tempValues.last!))
        }

        guard let res = PQexecParams(self.conn, statement, Int32(params.count),
                                     nil, values, nil, nil, Int32(0)) else {
            try failWithError(); return nil
        }

        return try validateQueryResultStatus(res)

        let conn = PQsetdbLogin(host, String(port), "", "", dbName, user, password)

        guard PQstatus(conn) == CONNECTION_OK else {
            throw failWithError(conn)
        }

        self.conn = conn
