fix: mailbox deletion error handling

This commit is contained in:
Linus Rath
2026-04-02 11:24:11 +02:00
parent 8836f9cdca
commit 16557830ae
11 changed files with 34 additions and 3 deletions
+12 -2
View File
@@ -200,8 +200,18 @@ export function FolderSettings() {
await deleteMailbox(client, mailboxId);
setDeletingId(null);
toast.success(t('folder_deleted'));
} catch {
toast.error(t('error_delete'));
} catch (err: unknown) {
const jmapType = (err as Error & { jmapType?: string })?.jmapType;
switch (jmapType) {
case 'mailboxHasChild':
toast.error(t('error_delete_has_children'));
break;
case 'mailboxHasEmail':
toast.error(t('error_delete_has_email'));
break;
default:
toast.error(t('error_delete'));
}
} finally {
setIsLoading(false);
}