mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-25 07:25:12 +00:00
fix: add suuport Japanese message of errors. (#11159)
* fix: add suuport Japanese message of errors. * fix: change catching function. * lint --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
parent
d2764944cf
commit
246d167c81
1 changed files with 3 additions and 1 deletions
|
@ -1,3 +1,5 @@
|
|||
import { QueryFailedError } from 'typeorm';
|
||||
|
||||
export function isDuplicateKeyValueError(e: unknown | Error): boolean {
|
||||
return (e as any).message && (e as Error).message.startsWith('duplicate key value');
|
||||
return e instanceof QueryFailedError && e.driverError.code === '23505';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue