mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 21:21:02 +00:00
fix(api): db error on duplicate music library import
When the spotify crawler loop would import an artist multiple
times in parallel the first would succeed but the following queries
would throw with following exception:
QueryFailedError: duplicate key value violates unique constraint "IDX_ARTIST_SPOTIFY_ID"
This error also could happen for the album or track.
This commit is contained in:
parent
0e431e9aa8
commit
fcc2f7d1b6
2 changed files with 47 additions and 3 deletions
8
src/database/error-codes.ts
Normal file
8
src/database/error-codes.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* Offical postgres error codes to match against when checking database exceptions.
|
||||
*
|
||||
* https://www.postgresql.org/docs/current/errcodes-appendix.html
|
||||
*/
|
||||
export enum PostgresErrorCodes {
|
||||
UNIQUE_VIOLATION = "23505",
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue