我正在使用FileTransfer插件下载文件,我遇到的问题是,当主机无法访问时,我无法解决连接超时错误。
代码:
var fileTransfer = new FileTransfer();
var host = '192.168.1.30';
var port = '9080';
var uri = encodeURI("http://"+host+":"+port+"/FilesWeb/" + fileName);
fileTransfer.download(
uri,
'myFile.txt',
function(entry) {
alert('ok');
},
function(error) {
alert('error');
},
false,
{}
);
超时异常:
2013-12-07 22:22:20.089 Mapfre[720:907] FileTransferError {
body = "";
code = 3;
"http_status" = 0;
source = "http://192.168.1.40:10080/FilesWeb/3.txt";
target = "/var/mobile/Applications/1DD0DC96-D34C-4E91-A15F-609B93DE84E4/Documents/xxx/fichas/3.txt";
}2013-12-07 22:22:20.092 Mapfre[720:907] File Transfer Error: The request timed out.
如何捕获该异常?
谢谢。