fix(merge-pdf): keep worker errors out of the alert, add missing fr key

This commit is contained in:
Adrien Boullé
2026-10-19 12:30:29 +02:00
parent ab8f4c20a8
commit 448035b77b
3 changed files with 11 additions and 4 deletions
+3 -4
View File
@@ -419,11 +419,10 @@ export async function merge() {
}
);
} else {
// The worker has no access to i18next: its message is technical and
// English-only, so it goes to the console, not to the user.
console.error('Worker merge error:', e.data.message);
showAlert(
t('common.error'),
e.data.message || t('tools:mergePdf.alert.mergeFailed')
);
showAlert(t('common.error'), t('tools:mergePdf.alert.mergeFailed'));
}
};
+7
View File
@@ -39,6 +39,13 @@ describe('merge PDF notifications are localized', () => {
expect(literalCalls).toHaveLength(0);
});
it('never surfaces the raw worker message to the user', () => {
const rawWorkerMessageInAlert = [
...source.matchAll(/\bshowAlert\([^;]*?\be\.data\.message/gs),
];
expect(rawWorkerMessageInAlert).toHaveLength(0);
});
it('references at least the alert and loader keys added for the merge tool', () => {
expect(usedKeys).toContain('tools:mergePdf.alert.mergeSuccess');
expect(usedKeys).toContain('tools:mergePdf.loader.merging');