fix(magic-notes): preserve duplicate-tag error cause

This commit is contained in:
mesalogo
2026-10-07 21:38:13 +08:00
parent c465d39d58
commit 3e3a021682
+3 -1
View File
@@ -4186,7 +4186,9 @@ export class AssistantDatabase {
VALUES (?, ?, ?, ?, ?)`
).run(id, input.name, key, now, now)
} catch (error) {
if (error instanceof Error && error.message.includes('UNIQUE')) throw new Error('标签已存在')
if (error instanceof Error && error.message.includes('UNIQUE')) {
throw new Error('标签已存在', { cause: error })
}
throw error
}
this.options.onMagicNotesChanged?.()