fix: allow error messages to be set via catch

This commit is contained in:
Tyler Stewart
2017-05-11 15:36:49 -06:00
parent 580b8d6eae
commit 14e5f87cc3
11 changed files with 12 additions and 11 deletions

View File

@@ -12,7 +12,7 @@ module.exports = {
})
.catch(err => {
log.error(err);
return this.reply(550);
return this.reply(550, err.message);
});
},
syntax: '{{cmd}} [path]',

View File

@@ -48,7 +48,7 @@ module.exports = {
})
.catch(err => {
log.error(err);
return this.reply(err.code || 451, err.message || 'No directory');
return this.reply(451, err.message || 'No directory');
})
.finally(() => {
this.connector.end();

View File

@@ -14,7 +14,7 @@ module.exports = {
})
.catch(err => {
log.error(err);
return this.reply(550);
return this.reply(550, err.message);
});
},
syntax: '{{cmd}} [path]',

View File

@@ -14,7 +14,7 @@ module.exports = {
})
.catch(err => {
log.error(err);
return this.reply(550);
return this.reply(550, err.message);
});
},
syntax: '{{cmd}}[path]',

View File

@@ -29,7 +29,7 @@ module.exports = {
})
.catch(err => {
log.error(err);
return this.reply(551);
return this.reply(551, err.message);
})
.finally(() => {
this.connector.end();

View File

@@ -14,7 +14,7 @@ module.exports = {
})
.catch(err => {
log.error(err);
return this.reply(550);
return this.reply(550, err.message);
});
},
syntax: '{{cmd}} [name]',

View File

@@ -17,7 +17,7 @@ module.exports = {
})
.catch(err => {
log.error(err);
return this.reply(550);
return this.reply(550, err.message);
})
.finally(() => {
delete this.renameFrom;

View File

@@ -12,7 +12,7 @@ module.exports = {
})
.catch(err => {
log.error(err);
return this.reply(550);
return this.reply(550, err.message);
});
},
syntax: '{{cmd}} [path]',

View File

@@ -33,7 +33,7 @@ module.exports = {
})
.catch(err => {
log.error(err);
return this.reply(450);
return this.reply(450, err.message);
});
} else {
return this.reply(211, 'Status OK');

View File

@@ -32,7 +32,7 @@ module.exports = {
})
.catch(err => {
log.error(err);
return this.reply(553);
return this.reply(550, err.message);
})
.finally(() => {
this.connector.end();

View File

@@ -6,6 +6,7 @@ module.exports = {
this.username = command.arg;
if (!this.username) return this.reply(501, 'Must send username requirement');
if (this.server.options.anonymous === true) {
return this.login(this.username, '@anonymous')
.then(() => {
@@ -13,7 +14,7 @@ module.exports = {
})
.catch(err => {
log.error(err);
return this.reply(530, err || 'Authentication failed');
return this.reply(530, err.message || 'Authentication failed');
});
}
return this.reply(331);