From 7d15b0cd003f7f5d0b9eb67a7e9217fc9c3ad3df Mon Sep 17 00:00:00 2001 From: Louis-Dominique Dubeau Date: Fri, 4 Oct 2019 16:05:15 -0400 Subject: [PATCH] refactor: replace call to closeText with internal error --- lib/saxes.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/saxes.js b/lib/saxes.js index 1a5774d2..552ca064 100644 --- a/lib/saxes.js +++ b/lib/saxes.js @@ -995,8 +995,10 @@ class SaxesParser { switch (c) { case LESS: this.state = S_OPEN_WAKA; + // We could naively call closeText but in this state, it is not normal + // to have text be filled with any data. if (this.text.length !== 0) { - this.closeText(); + throw new Error("no-empty text at start"); } break; case EOC: