mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 18:07:31 -07:00
fix: 🐛 proper isDuplicateKeyValueError handling
Closes #10340 Co-authored-by: Kainoa Kanter <kainoa@t1c.dev>
This commit is contained in:
parent
0efc2659f2
commit
b8b0abb453
1 changed files with 2 additions and 1 deletions
|
@ -1,3 +1,4 @@
|
||||||
export function isDuplicateKeyValueError(e: unknown | Error): boolean {
|
export function isDuplicateKeyValueError(e: unknown | Error): boolean {
|
||||||
return (e as Error).message?.startsWith("duplicate key value");
|
const nodeError = e as NodeJS.ErrnoException;
|
||||||
|
return nodeError.code === "23505";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue