fix: allow error messages to be set via catch
This commit is contained in:
@@ -12,7 +12,7 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
log.error(err);
|
log.error(err);
|
||||||
return this.reply(550);
|
return this.reply(550, err.message);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
syntax: '{{cmd}} [path]',
|
syntax: '{{cmd}} [path]',
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
log.error(err);
|
log.error(err);
|
||||||
return this.reply(err.code || 451, err.message || 'No directory');
|
return this.reply(451, err.message || 'No directory');
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.connector.end();
|
this.connector.end();
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
log.error(err);
|
log.error(err);
|
||||||
return this.reply(550);
|
return this.reply(550, err.message);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
syntax: '{{cmd}} [path]',
|
syntax: '{{cmd}} [path]',
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
log.error(err);
|
log.error(err);
|
||||||
return this.reply(550);
|
return this.reply(550, err.message);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
syntax: '{{cmd}}[path]',
|
syntax: '{{cmd}}[path]',
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
log.error(err);
|
log.error(err);
|
||||||
return this.reply(551);
|
return this.reply(551, err.message);
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.connector.end();
|
this.connector.end();
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
log.error(err);
|
log.error(err);
|
||||||
return this.reply(550);
|
return this.reply(550, err.message);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
syntax: '{{cmd}} [name]',
|
syntax: '{{cmd}} [name]',
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
log.error(err);
|
log.error(err);
|
||||||
return this.reply(550);
|
return this.reply(550, err.message);
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
delete this.renameFrom;
|
delete this.renameFrom;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
log.error(err);
|
log.error(err);
|
||||||
return this.reply(550);
|
return this.reply(550, err.message);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
syntax: '{{cmd}} [path]',
|
syntax: '{{cmd}} [path]',
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
log.error(err);
|
log.error(err);
|
||||||
return this.reply(450);
|
return this.reply(450, err.message);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return this.reply(211, 'Status OK');
|
return this.reply(211, 'Status OK');
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
log.error(err);
|
log.error(err);
|
||||||
return this.reply(553);
|
return this.reply(550, err.message);
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.connector.end();
|
this.connector.end();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ module.exports = {
|
|||||||
this.username = command.arg;
|
this.username = command.arg;
|
||||||
if (!this.username) return this.reply(501, 'Must send username requirement');
|
if (!this.username) return this.reply(501, 'Must send username requirement');
|
||||||
|
|
||||||
|
|
||||||
if (this.server.options.anonymous === true) {
|
if (this.server.options.anonymous === true) {
|
||||||
return this.login(this.username, '@anonymous')
|
return this.login(this.username, '@anonymous')
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@@ -13,7 +14,7 @@ module.exports = {
|
|||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
log.error(err);
|
log.error(err);
|
||||||
return this.reply(530, err || 'Authentication failed');
|
return this.reply(530, err.message || 'Authentication failed');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return this.reply(331);
|
return this.reply(331);
|
||||||
|
|||||||
Reference in New Issue
Block a user