Comparing version 35.1.0 to 35.2.0
@@ -53,6 +53,10 @@ import { type PrimitiveValueExpression, type Query, type QueryResultRow } from './types'; | ||
type IntegrityConstraintViolationErrorCause = Error & { | ||
constraint: string; | ||
column?: string; | ||
constraint?: string; | ||
table?: string; | ||
}; | ||
export declare class IntegrityConstraintViolationError extends SlonikError { | ||
constraint: string; | ||
constraint: string | null; | ||
column: string | null; | ||
table: string | null; | ||
cause?: Error; | ||
@@ -59,0 +63,0 @@ constructor(message: string, error: IntegrityConstraintViolationErrorCause); |
@@ -93,7 +93,7 @@ "use strict"; | ||
constructor(message, error) { | ||
var _a, _b, _c; | ||
super(message, { cause: error }); | ||
if (!error.constraint) { | ||
throw new Error('IntegrityConstraintViolationError requires constraint name.'); | ||
} | ||
this.constraint = error.constraint; | ||
this.constraint = (_a = error.constraint) !== null && _a !== void 0 ? _a : null; | ||
this.column = (_b = error.column) !== null && _b !== void 0 ? _b : null; | ||
this.table = (_c = error.table) !== null && _c !== void 0 ? _c : null; | ||
} | ||
@@ -100,0 +100,0 @@ } |
@@ -100,3 +100,3 @@ { | ||
"types": "./dist/index.d.ts", | ||
"version": "35.1.0" | ||
"version": "35.2.0" | ||
} |
@@ -116,8 +116,14 @@ import { | ||
type IntegrityConstraintViolationErrorCause = Error & { | ||
constraint: string; | ||
column?: string; | ||
constraint?: string; | ||
table?: string; | ||
}; | ||
export class IntegrityConstraintViolationError extends SlonikError { | ||
public constraint: string; | ||
public constraint: string | null; | ||
public column: string | null; | ||
public table: string | null; | ||
public cause?: Error; | ||
@@ -131,9 +137,7 @@ | ||
if (!error.constraint) { | ||
throw new Error( | ||
'IntegrityConstraintViolationError requires constraint name.', | ||
); | ||
} | ||
this.constraint = error.constraint ?? null; | ||
this.constraint = error.constraint; | ||
this.column = error.column ?? null; | ||
this.table = error.table ?? null; | ||
} | ||
@@ -140,0 +144,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
507985
7394