             }
             
             // Successful
-            if response?.hasPrefix("35") ?? false {
+            guard let response = response else {
+                completionHandler(self.throwError("", code: URLError.badServerResponse))
+                return
+            }
+            
+            if response.hasPrefix("35") {
                 completionHandler(nil)
             } else {
-                let spaceIndex = response?.characters.index(of: "-") ?? response?.startIndex
-                let code = Int((response?.substring(to: spaceIndex!).trimmingCharacters(in: .whitespacesAndNewlines))!) ?? -1
-                let description = response?.substring(from: spaceIndex!).trimmingCharacters(in: .whitespacesAndNewlines)
-                let error = FileProviderFTPError(code: code, path: "", errorDescription: description)
+                let error = FileProviderFTPError(message: response, path: "")
                 completionHandler(error)
                 return
             }

        if self.passiveMode {
            self.ftpPassive(task, completionHandler: completionHandler)
        } else {
            self.ftpActive(task, completionHandler: completionHandler)
        }
    }
    

                }
                
                if !success && !(response.hasPrefix("25") || response.hasPrefix("15")) {
                    let error = FileProviderFTPError(message: response, path: path)
                    self.dispatch_queue.async {
                        completionHandler([], error)
                    }
