@@ -161,7 +161,7 @@ public class Client {
161161 ///
162162 /// :param: srcIndexName the name of index to move.
163163 /// :param: dstIndexName the new index name that will contains sourceIndexName (destination will be overriten if it already exist).
164- public func moveIndex( srcIndexName: String , dstIndexName: String , block: CompletionHandler ? = nil ) {
164+ public func moveIndex( srcIndexName: String , to dstIndexName: String , block: CompletionHandler ? = nil ) {
165165 let path = " 1/indexes/ \( srcIndexName. urlEncode ( ) ) /operation "
166166 let request = [
167167 " destination " : dstIndexName,
@@ -175,7 +175,7 @@ public class Client {
175175 ///
176176 /// :param: srcIndexName the name of index to copy.
177177 /// :param: dstIndexName the new index name that will contains a copy of sourceIndexName (destination will be overriten if it already exist).
178- public func copyIndex( srcIndexName: String , dstIndexName: String , block: CompletionHandler ? = nil ) {
178+ public func copyIndex( srcIndexName: String , to dstIndexName: String , block: CompletionHandler ? = nil ) {
179179 let path = " 1/indexes/ \( srcIndexName. urlEncode ( ) ) /operation "
180180 let request = [
181181 " destination " : dstIndexName,
@@ -361,7 +361,8 @@ public class Client {
361361 case 200 , 201 :
362362 block ( JSON: ( data as [ String : AnyObject ] ) , error: nil )
363363 case 400 :
364- block ( JSON: nil , error: NSError ( domain: " Bad request argument " , code: 400 , userInfo: nil ) )
364+ let errorMessage = data![ " message " ] as String
365+ block ( JSON: nil , error: NSError ( domain: " Bad request argument: \( errorMessage) " , code: 400 , userInfo: nil ) )
365366 case 403 :
366367 block ( JSON: nil , error: NSError ( domain: " Invalid Application-ID or API-Key " , code: 403 , userInfo: nil ) )
367368 case 404 :
0 commit comments