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
+4 -1
View File
@@ -1320,7 +1320,10 @@ export class JMAPClient implements IJMAPClient {
const result = response.methodResponses?.[0]?.[1];
if (result?.notDestroyed?.[mailboxId]) {
throw new Error(`Failed to delete mailbox: ${result.notDestroyed[mailboxId].type || 'unknown error'}`);
const err = result.notDestroyed[mailboxId];
const error = new Error(err.description || `Failed to delete mailbox: ${err.type || 'unknown error'}`);
(error as Error & { jmapType?: string }).jmapType = err.type;
throw error;
}
}