forked from Vincit/db-errors
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
51 lines (41 loc) · 998 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
declare namespace DbTypes {
class DBError extends Error {
name: string;
nativeError: Error;
}
class CheckViolationError extends DBError {
table: string;
constraint: string;
}
class ConstraintViolationError extends DBError {}
class DataError extends DBError {}
class ForeignKeyViolationError extends ConstraintViolationError {
table: string;
constraint: string;
schema?: string;
}
class NotNullViolationError extends ConstraintViolationError {
table: string;
column: string;
database?: string;
schema?: string;
}
class UniqueViolationError extends ConstraintViolationError {
table: string;
columns: string[];
constraint: string;
schema?: string;
}
function wrapError(err: Error): DBError
export {
wrapError,
DBError,
CheckViolationError,
ConstraintViolationError,
DataError,
ForeignKeyViolationError,
NotNullViolationError,
UniqueViolationError,
}
}
export = DbTypes