From 43f20500879884805d2596ecc7d1604e4024801e Mon Sep 17 00:00:00 2001 From: Alexander Jones Date: Mon, 7 Oct 2024 16:44:10 -0500 Subject: [PATCH] Use new IssueError static method to throw IssueErrors --- parser/parsedHedTag.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/parser/parsedHedTag.js b/parser/parsedHedTag.js index 420b0f72..6542f74e 100644 --- a/parser/parsedHedTag.js +++ b/parser/parsedHedTag.js @@ -317,7 +317,9 @@ export class ParsedHed3Tag extends ParsedHedTag { _convertTag(hedSchemas, hedString, tagSpec) { const hed3ValidCharacters = /^[^{}[\]()~,\0\t]+$/ if (!hed3ValidCharacters.test(this.originalTag)) { - throw new Error('The parser failed to properly remove an illegal or special character.') + IssueError.generateAndThrow('internalConsistencyError', { + message: 'The parser failed to properly remove an illegal or special character.', + }) } const schemaName = tagSpec.library @@ -325,18 +327,14 @@ export class ParsedHed3Tag extends ParsedHedTag { if (this.schema === undefined) { this.canonicalTag = this.originalTag if (schemaName !== '') { - throw new IssueError( - generateIssue('unmatchedLibrarySchema', { - tag: this.originalTag, - library: schemaName, - }), - ) + IssueError.generateAndThrow('unmatchedLibrarySchema', { + tag: this.originalTag, + library: schemaName, + }) } else { - throw new IssueError( - generateIssue('unmatchedBaseSchema', { - tag: this.originalTag, - }), - ) + IssueError.generateAndThrow('unmatchedBaseSchema', { + tag: this.originalTag, + }) } }