chore(): start moving some packages to the core directory (#7215)
This commit is contained in:
committed by
GitHub
parent
fdee748eed
commit
bbccd6481d
2
packages/core/utils/src/exceptions/index.ts
Normal file
2
packages/core/utils/src/exceptions/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./postgres-error"
|
||||
export * from "./is-duplicate-error"
|
||||
4
packages/core/utils/src/exceptions/is-duplicate-error.ts
Normal file
4
packages/core/utils/src/exceptions/is-duplicate-error.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { PostgresError } from "./postgres-error"
|
||||
export const isDuplicateError = (err: Error & { code?: string }) => {
|
||||
return err.code === PostgresError.DUPLICATE_ERROR
|
||||
}
|
||||
6
packages/core/utils/src/exceptions/postgres-error.ts
Normal file
6
packages/core/utils/src/exceptions/postgres-error.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export enum PostgresError {
|
||||
DUPLICATE_ERROR = "23505",
|
||||
FOREIGN_KEY_ERROR = "23503",
|
||||
SERIALIZATION_FAILURE = "40001",
|
||||
NULL_VIOLATION = "23502",
|
||||
}
|
||||
Reference in New Issue
Block a user