From a40ee0176749e8079824beceb48d6ff5dc7bb2e9 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Fri, 27 Jan 2023 13:06:00 -0600 Subject: [PATCH] =?UTF-8?q?feat(developer):=20ldml=20import/implied=20keys?= =?UTF-8?q?=20:=20review=20comment=20=F0=9F=99=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - add a TODO comment about using a custom error class --- common/web/types/src/ldml-keyboard/ldml-keyboard-xml-reader.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/web/types/src/ldml-keyboard/ldml-keyboard-xml-reader.ts b/common/web/types/src/ldml-keyboard/ldml-keyboard-xml-reader.ts index dc1a05d03b..5558fd7199 100644 --- a/common/web/types/src/ldml-keyboard/ldml-keyboard-xml-reader.ts +++ b/common/web/types/src/ldml-keyboard/ldml-keyboard-xml-reader.ts @@ -118,10 +118,11 @@ export default class LDMLKeyboardXMLSourceFileReader { private resolveOneImport(obj: any, subtag: string, asImport: LKImport) { if (asImport.base !== constants.cldr_import_base) { + // TODO-LDML: use custom error class CompilerImportResolveError throw new Error(`import element with base ${asImport.base} is unsupported, only ${constants.cldr_import_base} is supported.`); } const paths = asImport.path.split('/'); - if (!paths[0] || !paths[1] || paths.length !== 2) { + if (paths[0] == '' || paths[1] == '' || paths.length !== 2) { throw new Error(`import element with invalid path ${asImport.path}: expect the form '${constants.cldr_version_latest}./*.xml'`); } const importData: Uint8Array = this.readImportFile(paths[0], paths[1]);