mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-07 13:15:28 +02:00
Catch ACS parse exception
This commit is contained in:
parent
ef7f6355c6
commit
a54caed41e
1 changed files with 13 additions and 2 deletions
11
core/acs.js
11
core/acs.js
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
// ENiGMA½
|
// ENiGMA½
|
||||||
const checkAcs = require('./acs_parser.js').parse;
|
const checkAcs = require('./acs_parser.js').parse;
|
||||||
|
const Log = require('./logger.js').log;
|
||||||
|
|
||||||
// deps
|
// deps
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
@ -16,7 +17,12 @@ class ACS {
|
||||||
check(acs, scope, defaultAcs) {
|
check(acs, scope, defaultAcs) {
|
||||||
acs = acs ? acs[scope] : defaultAcs;
|
acs = acs ? acs[scope] : defaultAcs;
|
||||||
acs = acs || defaultAcs;
|
acs = acs || defaultAcs;
|
||||||
|
try {
|
||||||
return checkAcs(acs, { client : this.client } );
|
return checkAcs(acs, { client : this.client } );
|
||||||
|
} catch(e) {
|
||||||
|
Log.warn( { exception : e, acs : acs }, 'Exception caught checking ACS');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hasMessageConfRead(conf) {
|
hasMessageConfRead(conf) {
|
||||||
|
@ -33,7 +39,12 @@ class ACS {
|
||||||
|
|
||||||
const matchCond = condArray.find( cond => {
|
const matchCond = condArray.find( cond => {
|
||||||
if(_.has(cond, 'acs')) {
|
if(_.has(cond, 'acs')) {
|
||||||
|
try {
|
||||||
return checkAcs(cond.acs, { client : this.client } );
|
return checkAcs(cond.acs, { client : this.client } );
|
||||||
|
} catch(e) {
|
||||||
|
Log.warn( { exception : e, acs : cond }, 'Exception caught checking ACS');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return true; // no acs check req.
|
return true; // no acs check req.
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue