misskey/packages/backend/src/misc/is-duplicate-key-value-error.ts
SASAGAWA Kiyoshi 246d167c81
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>
2023-07-08 21:10:52 +09:00

6 lines
192 B
TypeScript

import { QueryFailedError } from 'typeorm';
export function isDuplicateKeyValueError(e: unknown | Error): boolean {
return e instanceof QueryFailedError && e.driverError.code === '23505';
}