5

I'm using the FileTransfer plugin for downloading files, the issue I have is that I'm not able to cach the connection time out error when the host is not reachable.

The code:

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,
    {}
);

The timeout exception:

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.

How can I catch that exception?

Thank you.

Jxadro
  • 1,497
  • 2
  • 16
  • 36

0 Answers0