@effectify/prisma 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -201,7 +201,7 @@ export type PrismaError =
|
|
|
201
201
|
// Generic mapper for raw operations and fallback
|
|
202
202
|
const mapError = (error: unknown, operation: string, model: string): PrismaError => {
|
|
203
203
|
if (error instanceof PrismaNamespace.PrismaClientKnownRequestError) {
|
|
204
|
-
switch (error.
|
|
204
|
+
switch (error instanceof PrismaNamespace.PrismaClientKnownRequestError) {
|
|
205
205
|
case "P2000":
|
|
206
206
|
return new PrismaValueTooLongError({ cause: error, operation, model });
|
|
207
207
|
case "P2002":
|
|
@@ -142,7 +142,7 @@ export type PrismaUpdateManyError =
|
|
|
142
142
|
// Create, Upsert
|
|
143
143
|
export const mapCreateError = (error: unknown, operation: string, model: string): PrismaCreateError => {
|
|
144
144
|
if (error instanceof PrismaNamespace.PrismaClientKnownRequestError) {
|
|
145
|
-
switch (error.
|
|
145
|
+
switch (error instanceof PrismaNamespace.PrismaClientKnownRequestError) {
|
|
146
146
|
case 'P2000':
|
|
147
147
|
return new PrismaValueTooLongError({ cause: error, operation, model })
|
|
148
148
|
case 'P2002':
|
|
@@ -175,7 +175,7 @@ export const mapCreateError = (error: unknown, operation: string, model: string)
|
|
|
175
175
|
// Update
|
|
176
176
|
export const mapUpdateError = (error: unknown, operation: string, model: string): PrismaUpdateError => {
|
|
177
177
|
if (error instanceof PrismaNamespace.PrismaClientKnownRequestError) {
|
|
178
|
-
switch (error.
|
|
178
|
+
switch (error instanceof PrismaNamespace.PrismaClientKnownRequestError) {
|
|
179
179
|
case "P2000":
|
|
180
180
|
return new PrismaValueTooLongError({ cause: error, operation, model });
|
|
181
181
|
case "P2002":
|
|
@@ -212,7 +212,7 @@ export const mapUpdateError = (error: unknown, operation: string, model: string)
|
|
|
212
212
|
// Delete
|
|
213
213
|
export const mapDeleteError = (error: unknown, operation: string, model: string): PrismaDeleteError => {
|
|
214
214
|
if (error instanceof PrismaNamespace.PrismaClientKnownRequestError) {
|
|
215
|
-
switch (error.
|
|
215
|
+
switch (error instanceof PrismaNamespace.PrismaClientKnownRequestError) {
|
|
216
216
|
case "P2003":
|
|
217
217
|
return new PrismaForeignKeyConstraintError({ cause: error, operation, model });
|
|
218
218
|
case "P2014":
|
|
@@ -231,7 +231,7 @@ export const mapDeleteError = (error: unknown, operation: string, model: string)
|
|
|
231
231
|
// FindOrThrow
|
|
232
232
|
export const mapFindOrThrowError = (error: unknown, operation: string, model: string): PrismaFindOrThrowError => {
|
|
233
233
|
if (error instanceof PrismaNamespace.PrismaClientKnownRequestError) {
|
|
234
|
-
switch (error.
|
|
234
|
+
switch (error instanceof PrismaNamespace.PrismaClientKnownRequestError) {
|
|
235
235
|
case "P2024":
|
|
236
236
|
return new PrismaConnectionError({ cause: error, operation, model });
|
|
237
237
|
case "P2025":
|
|
@@ -244,7 +244,7 @@ export const mapFindOrThrowError = (error: unknown, operation: string, model: st
|
|
|
244
244
|
// Find
|
|
245
245
|
export const mapFindError = (error: unknown, operation: string, model: string): PrismaFindError => {
|
|
246
246
|
if (error instanceof PrismaNamespace.PrismaClientKnownRequestError) {
|
|
247
|
-
switch (error.
|
|
247
|
+
switch (error instanceof PrismaNamespace.PrismaClientKnownRequestError) {
|
|
248
248
|
case "P2024":
|
|
249
249
|
return new PrismaConnectionError({ cause: error, operation, model });
|
|
250
250
|
}
|
|
@@ -255,7 +255,7 @@ export const mapFindError = (error: unknown, operation: string, model: string):
|
|
|
255
255
|
// DeleteMany
|
|
256
256
|
export const mapDeleteManyError = (error: unknown, operation: string, model: string): PrismaDeleteManyError => {
|
|
257
257
|
if (error instanceof PrismaNamespace.PrismaClientKnownRequestError) {
|
|
258
|
-
switch (error.
|
|
258
|
+
switch (error instanceof PrismaNamespace.PrismaClientKnownRequestError) {
|
|
259
259
|
case "P2003":
|
|
260
260
|
return new PrismaForeignKeyConstraintError({ cause: error, operation, model });
|
|
261
261
|
case "P2014":
|
|
@@ -272,7 +272,7 @@ export const mapDeleteManyError = (error: unknown, operation: string, model: str
|
|
|
272
272
|
// UpdateMany
|
|
273
273
|
export const mapUpdateManyError = (error: unknown, operation: string, model: string): PrismaUpdateManyError => {
|
|
274
274
|
if (error instanceof PrismaNamespace.PrismaClientKnownRequestError) {
|
|
275
|
-
switch (error.
|
|
275
|
+
switch (error instanceof PrismaNamespace.PrismaClientKnownRequestError) {
|
|
276
276
|
case "P2000":
|
|
277
277
|
return new PrismaValueTooLongError({ cause: error, operation, model });
|
|
278
278
|
case "P2002":
|