From 877cd9767d866f4bb4533a2124fa280f75444c01 Mon Sep 17 00:00:00 2001 From: "Joshua A. Horton" Date: Thu, 4 Jul 2024 11:05:34 +0700 Subject: [PATCH] fix(common): add workaround for divergence of EventEmitter3 from node's version Node's version has special behavior for events named 'error' - if no handler, it auto-throws. EventEmitter3 does not include this. --- common/web/types/src/deps/xml2js/parser.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/web/types/src/deps/xml2js/parser.js b/common/web/types/src/deps/xml2js/parser.js index e7ca0e6cdc..1c7f148d90 100644 --- a/common/web/types/src/deps/xml2js/parser.js +++ b/common/web/types/src/deps/xml2js/parser.js @@ -323,7 +323,11 @@ export class Parser extends EventEmitter { } catch (error1) { err = error1; if (!(this.saxParser.errThrown || this.saxParser.ended)) { - this.emit('error', err); + if(this.listenerCount('error') > 0) { + this.emit('error', err); + } else { + throw err; + } return this.saxParser.errThrown = true; } else if (this.saxParser.ended) { throw err;