feat(developer): remove linebreak in Errormessages

This commit is contained in:
Sabine 2025-07-07 14:33:08 +02:00
parent 01830a4ede
commit 952dba6a2f
2 changed files with 10 additions and 15 deletions

View file

@ -23,31 +23,26 @@ export class ConverterMessages {
static ERROR_NoConverterFound = SevError | 0x0002;
static Error_NoConverterFound = (o: { inputFilename: string, outputFilename: string; }) => m(
this.ERROR_NoConverterFound,
`No converter is available that can convert from '${def(o.inputFilename)}' to '${def(o.outputFilename)}'.`);
this.ERROR_NoConverterFound, `No converter is available that can convert from '${def(o.inputFilename)}' to '${def(o.outputFilename)}'.`);
static ERROR_FileNotFound = SevError | 0x0003;
static Error_FileNotFound = (o: { inputFilename: string; }) => m(
this.ERROR_FileNotFound, `Input filename '${def(o.inputFilename)}
' does not exist or could not be loaded.`);
this.ERROR_FileNotFound, `Input filename '${def(o.inputFilename)} ' does not exist or could not be loaded.`);
static ERROR_UnableToRead = SevError | 0x0004;
static Error_UnableToRead = (o: { inputFilename: string; }) => m(
this.ERROR_UnableToRead, `Input file '${def(o.inputFilename)}
' could not be read.`);
this.ERROR_UnableToRead, `Input file '${def(o.inputFilename)} ' could not be read.`);
static ERROR_UnableToConvert = SevError | 0x0005;
static Error_UnableToConvert = (o: { inputFilename: string; }) => m(
this.ERROR_UnableToConvert, `Input file '${def(o.inputFilename)}
' could not be converted.`);
this.ERROR_UnableToConvert, `Input file '${def(o.inputFilename)} ' could not be converted.`);
static ERROR_UnableToWrite = SevError | 0x0006;
static Error_UnableToWrite = (o: { outputFilename: string; }) => m(
this.ERROR_UnableToWrite, `Output file for '${def(o.outputFilename)}
' could not be written.`);
this.ERROR_UnableToWrite, `Output file for '${def(o.outputFilename)} ' could not be written.`);
static ERROR_UnsupportedCharactersDetected = SevError | 0x0007;
static Error_UnsupportedCharactersDetected = (o: { inputFilename: string, keymap_index: string, key: string, output: string; }) => m(
this.ERROR_UnsupportedCharactersDetected, `Input file ${def(o.inputFilename)} contains unsupported character ('${def(o.output)}') on key (${def(o.key)}) at keyMap index ${def(o.keymap_index)}`);
}
}

View file

@ -63,12 +63,13 @@ export class KeylayoutToKmnConverter {
*/
async run(inputFilename: string, outputFilename?: string): Promise<ConverterToKmnResult> {
if (!inputFilename) {
this.callbacks.reportMessage(ConverterMessages.Error_FileNotFound({ inputFilename }));
return null;
}
outputFilename = outputFilename ?? inputFilename.replace(/\.keylayout$/, '.kmn');
const KeylayoutReader = new KeylayoutFileReader(this.callbacks/*, this.options*/);
const jsonO: object = KeylayoutReader.read(inputFilename);
if (!jsonO) {
@ -87,12 +88,11 @@ export class KeylayoutToKmnConverter {
// _S2 still write to file - may be removed later
const out_text_ok: boolean = kmnFileWriter.write(outArray);
if (!out_text_ok) {
this.callbacks.reportMessage(ConverterMessages.Error_UnableToWrite({ inputFilename }));
this.callbacks.reportMessage(ConverterMessages.Error_UnableToWrite({ outputFilename }));
return null;
}
// write to object/ConverterToKmnResult
outputFilename = outputFilename ?? inputFilename.replace(/\.keylayout$/, '.kmn');
const out_Uint8: Uint8Array = kmnFileWriter.writeToUint8Array(outArray);
const Result_toBeReturned: ConverterToKmnResult = {
artifacts: {
@ -133,7 +133,7 @@ export class KeylayoutToKmnConverter {
data_object.arrayOf_Rules = rules;
// _S2 ToDo remove this console.log
console.log("RUN kmc convert - input file: ",data_object.keylayout_filename, " --> output file: ", data_object.kmn_filename);
console.log("RUN kmc convert - input file: ", data_object.keylayout_filename, " --> output file: ", data_object.kmn_filename);
// create an array of modifier combinations and store in data_object
for (let j = 0; j < jsonObj.keyboard.modifierMap.keyMapSelect.length; j++) {