FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
PyGreSQL/pg/error.py at main · PyGreSQL/PyGreSQL · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
PyGreSQL
/
PyGreSQL
Public
Notifications
You must be signed in to change notification settings
Fork
20
Star
48
Code
Issues
21
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
PyGreSQL
/
pg
/
error.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
59 lines (42 loc) · 1.16 KB
Breadcrumbs
PyGreSQL
/
pg
/
error.py
Copy path
File metadata and controls
59 lines (42 loc) · 1.16 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
52
53
54
55
56
57
58
59
"""Error helpers."""
from
__future__
import
annotations
from
typing
import
TypeVar
from
.
core
import
(
DatabaseError
,
Error
,
InterfaceError
,
InternalError
,
OperationalError
,
ProgrammingError
,
)
__all__
=
[
'db_error'
,
'error'
,
'if_error'
,
'int_error'
,
'op_error'
,
'prg_error'
]
# Error messages
E
=
TypeVar
(
'E'
,
bound
=
Error
)
def
error
(
msg
:
str
,
cls
:
type
[
E
])
->
E
:
"""Return specified error object with empty sqlstate attribute."""
error
=
cls
(
msg
)
if
isinstance
(
error
,
DatabaseError
):
error
.
sqlstate
=
None
return
error
def
db_error
(
msg
:
str
)
->
DatabaseError
:
"""Return DatabaseError."""
return
error
(
msg
,
DatabaseError
)
def
int_error
(
msg
:
str
)
->
InternalError
:
"""Return InternalError."""
return
error
(
msg
,
InternalError
)
def
prg_error
(
msg
:
str
)
->
ProgrammingError
:
"""Return ProgrammingError."""
return
error
(
msg
,
ProgrammingError
)
def
if_error
(
msg
:
str
)
->
InterfaceError
:
"""Return InterfaceError."""
return
error
(
msg
,
InterfaceError
)
def
op_error
(
msg
:
str
)
->
OperationalError
:
"""Return OperationalError."""
return
error
(
msg
,
OperationalError
)
Back
|
FazBrowse Home
|
New Git URL