mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
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
This commit is contained in:
parent
231f8b6a4d
commit
b411d59d43
@ -43,7 +43,7 @@ function ChangeNode(n) {
|
|||||||
try {
|
try {
|
||||||
node.re = new RegExp(from, "g");
|
node.re = new RegExp(from, "g");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
node.error("Invalid regex: "+from);
|
node.error(e.message);
|
||||||
}
|
}
|
||||||
if (typeof msg[node.property] === "string") {
|
if (typeof msg[node.property] === "string") {
|
||||||
msg[node.property] = (msg[node.property]).replace(node.re, node.to);
|
msg[node.property] = (msg[node.property]).replace(node.re, node.to);
|
||||||
|
Loading…
Reference in New Issue
Block a user