|
773 | 773 |
|
774 | 774 | _each((entrySupport ? dataTransfer.items : dataTransfer.files) || [], function (item){ |
775 | 775 | queue.inc(); |
| 776 | + |
776 | 777 | try { |
777 | 778 | if( entrySupport ){ |
778 | 779 | _readEntryAsFiles(item, function (err, entryFiles){ |
779 | | - !err && files.push.apply(files, entryFiles); |
| 780 | + if( err ){ |
| 781 | + api.log('[err] getDropFiles:', err); |
| 782 | + } else { |
| 783 | + files.push.apply(files, entryFiles); |
| 784 | + } |
780 | 785 | queue.next(); |
781 | 786 | }); |
782 | 787 | } |
|
789 | 794 | } |
790 | 795 | catch( err ){ |
791 | 796 | queue.next(); |
792 | | - api.log('getDropFiles.error:', err.toString()); |
| 797 | + api.log('[err] getDropFiles: ', err); |
793 | 798 | } |
794 | 799 | }); |
795 | 800 |
|
|
1529 | 1534 | function _readEntryAsFiles(entry, callback){ |
1530 | 1535 | if( !entry ){ |
1531 | 1536 | // error |
1532 | | - callback('empty_entry'); |
| 1537 | + callback('invalid entry'); |
1533 | 1538 | } |
1534 | 1539 | else if( entry.isFile ){ |
1535 | 1540 | // Read as file |
1536 | 1541 | entry.file(function(file){ |
1537 | 1542 | // success |
1538 | 1543 | file.fullPath = entry.fullPath; |
1539 | 1544 | callback(false, [file]); |
1540 | | - }, function (){ |
| 1545 | + }, function (err){ |
1541 | 1546 | // error |
1542 | | - callback('entry_file'); |
| 1547 | + callback('FileError.code: '+err.code); |
1543 | 1548 | }); |
1544 | 1549 | } |
1545 | 1550 | else if( entry.isDirectory ){ |
|
1549 | 1554 | // success |
1550 | 1555 | api.afor(entries, function (next, entry){ |
1551 | 1556 | _readEntryAsFiles(entry, function (err, files){ |
1552 | | - if( !err ){ |
| 1557 | + if( err ){ |
| 1558 | + api.log(err); |
| 1559 | + } |
| 1560 | + else { |
1553 | 1561 | result = result.concat(files); |
1554 | 1562 | } |
1555 | 1563 |
|
|
1561 | 1569 | } |
1562 | 1570 | }); |
1563 | 1571 | }); |
1564 | | - }, function (){ |
| 1572 | + }, function (err){ |
1565 | 1573 | // error |
1566 | | - callback('directory_reader'); |
| 1574 | + callback('directory_reader: ' + err); |
1567 | 1575 | }); |
1568 | 1576 | } |
1569 | 1577 | else { |
|
0 commit comments