misskey-awawa/packages/backend/src/misc/is-duplicate-key-value-erro...

4 lines
160 B
TypeScript

export function isDuplicateKeyValueError(e: unknown | Error): boolean {
return (e as any).message && (e as Error).message.startsWith('duplicate key value');
}