Fixed handling of unknown door types

This commit is contained in:
Nathan Byrd 2023-11-05 00:21:49 +00:00
parent 9bb8277583
commit 04392e387d
3 changed files with 18 additions and 11 deletions

View File

@ -158,6 +158,11 @@ exports.getModule = class AbracadabraModule extends MenuModule {
fileType: self.config.dropFileType, fileType: self.config.dropFileType,
}); });
if(!(self.dropFile.isSupported())) {
// Return error so complete will log and return
return callback(Errors.AccessDenied('Dropfile format not supported'));
}
return self.dropFile.createFile(callback); return self.dropFile.createFile(callback);
}, },
], ],

View File

@ -91,19 +91,21 @@ module.exports = class DropFile {
return undefined; return undefined;
} }
const filePath = paths.join(this.dropFileFormatDirectory, fileName); const filePath = paths.join(this.dropFileFormatDirectory, fileName);
fs.access(filePath, fs.constants.R_OK, err => { if(!fs.existsSync(filePath)) {
if (err) { Log.info({filename: fileName}, 'Dropfile format not found or readable.');
Log.info({filename: fileName}, 'Dropfile format not found.'); return undefined;
return undefined; }
}
});
// Return the handler to get the dropfile, because in the future we may have additional handlers // Return the handler to get the dropfile, because in the future we may have additional handlers
return this.getDropfile; return this.getDropfile;
} }
getContents() { getContents() {
const handler = this.getHandler().bind(this); const handlerRef = this.getHandler();
if(!handlerRef) {
return undefined;
}
const handler = handlerRef.bind(this);
const contents = handler(); const contents = handler();
return contents; return contents;
} }

View File

@ -8,17 +8,17 @@ NOTPROVIDED
{UI} {UI}
0 0
{CT} {CT}
{CT} {DT} {CT} {getCurrentDateMMDDYY}
{MC} {MC}
{DN} {DN}
999 999
0 0
999999 999999
555-555-5555 555-555-5555
{DT} {CT} {getCurrentDateMMDDYY} {CT}
NOVICE NOVICE
All All
{DT} {getCurrentDateMMDDYY}
{UC} {UC}
{SH} {SH}
0 0
@ -31,6 +31,6 @@ REMOTE
38400 38400
FALSE FALSE
Normal Connection Normal Connection
{DT} {CT} {getCurrentDateMMDDYY} {CT}
{ND} {ND}
0 0