Skip to content

Commit

Permalink
Use new IssueError static method to throw IssueErrors
Browse files Browse the repository at this point in the history
  • Loading branch information
happy5214 committed Oct 7, 2024
1 parent 88d5f27 commit 43f2050
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions parser/parsedHedTag.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,26 +317,24 @@ 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
this.schema = hedSchemas.getSchema(schemaName)
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,
})
}
}

Expand Down

0 comments on commit 43f2050

Please sign in to comment.