mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-06 08:55:34 +00:00
fix(developer): remove extra fatal exception
- remove the fatal exception about a failed section compiler, as it will always otherwise be propagated to the user Fixes: #10894
This commit is contained in:
parent
de503729e7
commit
e77a495477
5 changed files with 23 additions and 9 deletions
|
|
@ -343,11 +343,7 @@ export class LdmlKeyboardCompiler implements KeymanCompiler {
|
|||
}
|
||||
const sect = section.compile(globalSections);
|
||||
|
||||
/* c8 ignore next 7 */
|
||||
if(!sect) {
|
||||
// This should not happen -- validate() should have told us
|
||||
// if something is going to fail to compile
|
||||
this.callbacks.reportMessage(CompilerMessages.Fatal_SectionCompilerFailed({sect:section.id}));
|
||||
passed = false;
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import { util, CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageSpec as m, CompilerMessageDef as def, CompilerMessageSpecWithException } from "@keymanapp/common-types";
|
||||
import { util, CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageSpec as m, CompilerMessageDef as def } from "@keymanapp/common-types";
|
||||
// const SevInfo = CompilerErrorSeverity.Info | CompilerErrorNamespace.LdmlKeyboardCompiler;
|
||||
const SevHint = CompilerErrorSeverity.Hint | CompilerErrorNamespace.LdmlKeyboardCompiler;
|
||||
const SevWarn = CompilerErrorSeverity.Warn | CompilerErrorNamespace.LdmlKeyboardCompiler;
|
||||
const SevError = CompilerErrorSeverity.Error | CompilerErrorNamespace.LdmlKeyboardCompiler;
|
||||
const SevFatal = CompilerErrorSeverity.Fatal | CompilerErrorNamespace.LdmlKeyboardCompiler;
|
||||
// const SevFatal = CompilerErrorSeverity.Fatal | CompilerErrorNamespace.LdmlKeyboardCompiler;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
|
@ -59,9 +59,7 @@ export class CompilerMessages {
|
|||
static Error_MustBeAtLeastOneLayerElement = () =>
|
||||
m(this.ERROR_MustBeAtLeastOneLayerElement, `The source file must contain at least one layer element.`);
|
||||
|
||||
static FATAL_SectionCompilerFailed = SevFatal | 0x000F;
|
||||
static Fatal_SectionCompilerFailed = (o:{sect: string}) =>
|
||||
CompilerMessageSpecWithException(this.FATAL_SectionCompilerFailed, null, `The compiler for '${def(o.sect)}' failed unexpectedly.`);
|
||||
// 0x000F - available
|
||||
|
||||
/** annotate the to= or id= entry */
|
||||
private static outputOrKeyId(o:{output?: string, keyId?: string}) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,13 @@
|
|||
|
||||
<keys />
|
||||
|
||||
<!-- this is here because this test is used by test-compiler-e2e -->
|
||||
<layers formId="us">
|
||||
<layer id="base">
|
||||
<row keys="a b c" />
|
||||
</layer>
|
||||
</layers>
|
||||
|
||||
<transforms type="simple">
|
||||
<transformGroup>
|
||||
<transform from="\u0127" to="x"/> <!-- fail: use \u{1234} instead -->
|
||||
|
|
|
|||
|
|
@ -117,4 +117,16 @@ describe('compiler-tests', function() {
|
|||
]);
|
||||
assert.isNotNull(kmx);
|
||||
});
|
||||
it('should fail on extra escapes - sections/tran/fail-bad-tran-2.xml', async function() {
|
||||
const inputFilename = makePathToFixture('sections/tran/fail-bad-tran-2.xml');
|
||||
const kmx = await compileKeyboard(inputFilename, { ...compilerTestOptions, saveDebug: true, shouldAddCompilerVersion: false },
|
||||
[
|
||||
CompilerMessages.Error_InvalidQuadEscape({ cp: 295 }),
|
||||
],
|
||||
true, // validation should fail
|
||||
[
|
||||
// compiler messages (not reached, we've already failed)
|
||||
]);
|
||||
assert.isNull(kmx); // should fail post-validate
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -292,6 +292,7 @@ describe('tran', function () {
|
|||
],
|
||||
},
|
||||
{
|
||||
// also used in test-compiler-e2e.ts
|
||||
subpath: `sections/tran/fail-bad-tran-2.xml`,
|
||||
errors: [
|
||||
CompilerMessages.Error_InvalidQuadEscape({ cp: 295 }),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue