projects
/
pgwui_core
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
078281c
)
Avoid crash when a psycopg DatabaseError has no info from the db
author
Karl O. Pinc
<kop@karlpinc.com>
Sat, 22 Jun 2024 04:21:32 +0000
(23:21 -0500)
committer
Karl O. Pinc
<kop@karlpinc.com>
Sat, 22 Jun 2024 04:21:32 +0000
(23:21 -0500)
src/pgwui_core/exceptions.py
patch
|
blob
|
history
diff --git
a/src/pgwui_core/exceptions.py
b/src/pgwui_core/exceptions.py
index 0fd7b1f2106a9979253c61c5ce74edb4b6f6d03b..e9be180d35b552cde5ff0b674005611b6fabf309 100644
(file)
--- a/
src/pgwui_core/exceptions.py
+++ b/
src/pgwui_core/exceptions.py
@@
-204,7
+204,12
@@
class DBError(SetupError):
Produce an html formatted message from a psycopg3 DatabaseError
exception.
'''
- primary = html_escape(ex.diag.message_primary)
+ if ex.diag.message_primary is None:
+ # Produce _something_ in those cases where the message is from
+ # psycopg and not the db.
+ primary = str(ex)
+ else:
+ primary = html_escape(ex.diag.message_primary)
if ex.diag.message_detail is None:
detail = ''