Tidy + some logging

This commit is contained in:
Bryan Ashby 2020-05-06 17:34:37 -06:00
parent ec994211e0
commit 59ee52ea6f
No known key found for this signature in database
GPG Key ID: B49EB437951D2542
1 changed files with 13 additions and 8 deletions

View File

@ -2287,13 +2287,18 @@ FTNMessageScanTossModule.prototype.shutdown = function(cb) {
FTNMessageScanTossModule.prototype.performImport = function(cb) {
if(!this.hasValidConfiguration()) {
return cb(new Error('Missing or invalid configuration'));
return cb(Errors.MissingConfig('Invalid or missing configuration'));
}
const self = this;
async.each( [ 'inbound', 'secInbound' ], (inboundType, nextDir) => {
self.importFromDirectory(inboundType, self.moduleConfig.paths[inboundType], () => {
const importDir = self.moduleConfig.paths[inboundType];
self.importFromDirectory(inboundType, importDir, err => {
if (err) {
Log.warn({ importDir, error : err.message }, 'Error(s) during import');
}
return nextDir(null);
});
}, cb);
@ -2305,7 +2310,7 @@ FTNMessageScanTossModule.prototype.performExport = function(cb) {
// and let's find out what messages need exported.
//
if(!this.hasValidConfiguration()) {
return cb(new Error('Missing or invalid configuration'));
return cb(Errors.MissingConfig('Invalid or missing configuration'));
}
const self = this;
@ -2313,7 +2318,7 @@ FTNMessageScanTossModule.prototype.performExport = function(cb) {
async.eachSeries( [ 'EchoMail', 'NetMail' ], (type, nextType) => {
self[`perform${type}Export`]( err => {
if(err) {
Log.warn( { error : err.message, type : type }, 'Error(s) during export' );
Log.warn( { type, error : err.message }, 'Error(s) during export' );
}
return nextType(null); // try next, always
});