fix: log errors, improved messages (#156)

Spelling errors, improved error logs.
This commit is contained in:
Devonte
2020-09-08 15:38:14 +01:00
committed by GitHub
parent 05a68cfb08
commit c87ce2fef6
4 changed files with 12 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
module.exports = { module.exports = {
directive: 'PBSZ', directive: 'PBSZ',
handler: function ({command} = {}) { handler: function ({command} = {}) {
if (!this.secure) return this.reply(202, 'Not suppored'); if (!this.secure) return this.reply(202, 'Not supported');
this.bufferSize = parseInt(command.arg, 10); this.bufferSize = parseInt(command.arg, 10);
return this.reply(200, this.bufferSize === 0 ? 'OK' : 'Buffer too large: PBSZ=0'); return this.reply(200, this.bufferSize === 0 ? 'OK' : 'Buffer too large: PBSZ=0');
}, },

View File

@@ -3,7 +3,7 @@ const _ = require('lodash');
module.exports = { module.exports = {
directive: 'PROT', directive: 'PROT',
handler: function ({command} = {}) { handler: function ({command} = {}) {
if (!this.secure) return this.reply(202, 'Not suppored'); if (!this.secure) return this.reply(202, 'Not supported');
if (!this.bufferSize && typeof this.bufferSize !== 'number') return this.reply(503); if (!this.bufferSize && typeof this.bufferSize !== 'number') return this.reply(503);
switch (_.toUpper(command.arg)) { switch (_.toUpper(command.arg)) {

View File

@@ -129,10 +129,10 @@ class FtpConnection extends EventEmitter {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (letter.socket && letter.socket.writable) { if (letter.socket && letter.socket.writable) {
this.log.trace({port: letter.socket.address().port, encoding: letter.encoding, message: letter.message}, 'Reply'); this.log.trace({port: letter.socket.address().port, encoding: letter.encoding, message: letter.message}, 'Reply');
letter.socket.write(letter.message + '\r\n', letter.encoding, (err) => { letter.socket.write(letter.message + '\r\n', letter.encoding, (error) => {
if (err) { if (error) {
this.log.error(err); this.log.error('[Process Letter] Socket Write Error', { error: error.message });
return reject(err); return reject(error);
} }
resolve(); resolve();
}); });
@@ -147,8 +147,8 @@ class FtpConnection extends EventEmitter {
.then((satisfiedLetters) => Promise.mapSeries(satisfiedLetters, (letter, index) => { .then((satisfiedLetters) => Promise.mapSeries(satisfiedLetters, (letter, index) => {
return processLetter(letter, index); return processLetter(letter, index);
})) }))
.catch((err) => { .catch((error) => {
this.log.error(err); this.log.error('Satisfy Parameters Error', { error: error.message });
}); });
} }
} }

View File

@@ -86,6 +86,10 @@ class Passive extends Connector {
} }
}); });
}); });
})
.catch((error) => {
this.log.trace(error.message);
throw error;
}); });
} }