This commit is contained in:
seb
2026-09-22 07:25:16 +02:00
parent 4ed6260e91
commit cca131d83a
148 changed files with 5343 additions and 3466 deletions

View File

@@ -23,18 +23,26 @@
/**
* Checks whether an error is a unique-constraint violation.
* @param {unknown} err
* @param {any} err
* @returns {boolean}
*/
export function isUniqueConstraintError(err) {
throw new Error('Not implemented: isUniqueConstraintError');
return (
err?.number === 2627 ||
err?.number === 2601 ||
err?.code === 'SQLITE_CONSTRAINT_UNIQUE' ||
err?.code === 'SQLITE_CONSTRAINT_PRIMARYKEY'
);
}
/**
* Checks whether an error is a foreign-key-constraint violation.
* @param {unknown} err
* @param {any} err
* @returns {boolean}
*/
export function isForeignKeyConstraintError(err) {
throw new Error('Not implemented: isForeignKeyConstraintError');
return (
err?.number === 547 ||
err?.code === 'SQLITE_CONSTRAINT_FOREIGNKEY'
);
}