From a54caed41e9b20ade4f46f23bd59be79135ccae9 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Mon, 29 Aug 2016 21:01:51 -0600 Subject: [PATCH] Catch ACS parse exception --- core/acs.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/core/acs.js b/core/acs.js index 54145bcb..df89be9b 100644 --- a/core/acs.js +++ b/core/acs.js @@ -3,6 +3,7 @@ // ENiGMA½ const checkAcs = require('./acs_parser.js').parse; +const Log = require('./logger.js').log; // deps const assert = require('assert'); @@ -16,7 +17,12 @@ class ACS { check(acs, scope, defaultAcs) { acs = acs ? acs[scope] : defaultAcs; acs = acs || defaultAcs; - return checkAcs(acs, { client : this.client } ); + try { + return checkAcs(acs, { client : this.client } ); + } catch(e) { + Log.warn( { exception : e, acs : acs }, 'Exception caught checking ACS'); + return false; + } } hasMessageConfRead(conf) { @@ -33,7 +39,12 @@ class ACS { const matchCond = condArray.find( cond => { if(_.has(cond, 'acs')) { - return checkAcs(cond.acs, { client : this.client } ); + try { + return checkAcs(cond.acs, { client : this.client } ); + } catch(e) { + Log.warn( { exception : e, acs : cond }, 'Exception caught checking ACS'); + return false; + } } else { return true; // no acs check req. }