From b411d59d4367ec01ad0d5d4064eca75d2f6e7c7e Mon Sep 17 00:00:00 2001 From: Frank van de Pol Date: Tue, 24 Dec 2013 20:17:42 +0100 Subject: [PATCH] Make log message in invalid regular expressions more verbose Make logging of erratic regular expressions more verbose to help identification and resolving of the configuration issue: eg.: old: 24 Dec 18:40:09 - [error] [change:Strip kW] Invalid regex: *kW new: 24 Dec 18:40:09 - [error] [change:Strip kW] Invalid regular expression: /*kW/: Nothing to repeat old: 24 Dec 20:15:57 - [error] [change:Strip kW] Invalid regex: *kW new: 24 Dec 20:15:57 - [error] [change:Strip kW] Invalid regular expression: /[kW/: Unterminated character class --- nodes/core/logic/15-change.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodes/core/logic/15-change.js b/nodes/core/logic/15-change.js index 8922bde20..7c80a7863 100644 --- a/nodes/core/logic/15-change.js +++ b/nodes/core/logic/15-change.js @@ -43,7 +43,7 @@ function ChangeNode(n) { try { node.re = new RegExp(from, "g"); } catch (e) { - node.error("Invalid regex: "+from); + node.error(e.message); } if (typeof msg[node.property] === "string") { msg[node.property] = (msg[node.property]).replace(node.re, node.to);