mirror of
https://github.com/MisskeyIO/misskey
synced 2024-11-27 14:28:49 +09: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,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 New Issue
Block a user