bugfix: invalid banned word caused PrivilegeRefresher to fail to load

This commit is contained in:
evanpelle
2026-03-09 14:46:42 -07:00
parent eeb63f651a
commit fdaeaf66d0
+7 -3
View File
@@ -50,9 +50,13 @@ export function createMatcher(bannedWords: string[]): RegExpMatcher {
);
for (const word of bannedWords) {
customDataset.addPhrase((phrase) =>
phrase.setMetadata({ originalWord: word }).addPattern(pattern`${word}`),
);
try {
customDataset.addPhrase((phrase) =>
phrase.setMetadata({ originalWord: word }).addPattern(pattern`${word}`),
);
} catch (e) {
console.error(`Invalid banned word pattern "${word}": ${e}`);
}
}
return new RegExpMatcher({