mirror of
https://github.com/alam00000/bentopdf.git
synced 2026-11-08 00:50:59 +01:00
fix(merge-pdf): keep worker errors out of the alert, add missing fr key
This commit is contained in:
@@ -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'));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user