diff --git a/lib/unifile-ftp.js b/lib/unifile-ftp.js index ffdd7db..4b485dd 100644 --- a/lib/unifile-ftp.js +++ b/lib/unifile-ftp.js @@ -78,6 +78,7 @@ function callAPI(session, action, client, ...params) { if(err.code === 530) { throw new UnifileError(UnifileError.EACCES, 'Invalid credentials'); } + console.log(session, action, client, params); throw new UnifileError(UnifileError.EIO, err.message); }) .then((result) => { @@ -198,6 +199,8 @@ class FtpConnector { stat(session, path, ftpSession) { return callAPI(session, 'ls', ftpSession, path) .then((entries) => { + // Not found + if(entries.length === 0) throw new UnifileError(UnifileError.ENOENT, 'Not found'); // It's a file if(entries.length === 1) return toFileInfos(entries[0]); // It's a folder