mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-15 05:26:37 +03:00
Report the server response status on errors with no message
Suggested by Craig Ringer in pull request #353, should also give more information for other cases we were reported on flaky servers (AWS, digital ocean...), see bug #281.
This commit is contained in:
parent
e707c3f657
commit
3e31fb359e
6
NEWS
6
NEWS
|
@ -1,6 +1,12 @@
|
||||||
Current release
|
Current release
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
|
What's new in psycopg 2.6.2
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
- Report the server response status on errors (such as :ticket:`#281`).
|
||||||
|
|
||||||
|
|
||||||
What's new in psycopg 2.6.1
|
What's new in psycopg 2.6.1
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
|
|
@ -190,8 +190,10 @@ pq_raise(connectionObject *conn, cursorObject *curs, PGresult **pgres)
|
||||||
raise and a meaningful message is better than an empty one.
|
raise and a meaningful message is better than an empty one.
|
||||||
Note: it can happen without it being our error: see ticket #82 */
|
Note: it can happen without it being our error: see ticket #82 */
|
||||||
if (err == NULL || err[0] == '\0') {
|
if (err == NULL || err[0] == '\0') {
|
||||||
PyErr_SetString(DatabaseError,
|
PyErr_Format(DatabaseError,
|
||||||
"error with no message from the libpq");
|
"error with status %s and no message from the libpq",
|
||||||
|
PQresStatus(pgres == NULL ?
|
||||||
|
PQstatus(conn->pgconn) : PQresultStatus(*pgres)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user