Skip to content
Snippets Groups Projects
Commit 24f6d4bb authored by Stephen R. van den Berg's avatar Stephen R. van den Berg
Browse files

pgsql: Flush out unseen error/warning messages upon connection close.

parent a678bbc2
No related branches found
No related tags found
No related merge requests found
...@@ -1218,6 +1218,7 @@ private void procmessage() { ...@@ -1218,6 +1218,7 @@ private void procmessage() {
//! This function is PostgreSQL-specific, and thus it is not available //! This function is PostgreSQL-specific, and thus it is not available
//! through the generic SQL-interface. //! through the generic SQL-interface.
/*semi*/final void close() { /*semi*/final void close() {
throwdelayederror(this);
Thread.MutexKey lock; Thread.MutexKey lock;
if (qportals && qportals->size()) if (qportals && qportals->size())
catch(cancelquery()); catch(cancelquery());
...@@ -1232,8 +1233,17 @@ private void procmessage() { ...@@ -1232,8 +1233,17 @@ private void procmessage() {
} }
protected void destroy() { protected void destroy() {
catch(close()); string errstring;
mixed err = catch(close());
.pgsql_util.unregister_backend(); .pgsql_util.unregister_backend();
/*
* Flush out any asynchronously reported errors to stderr; because we are
* inside a destructor, throwing an error will not work anymore.
*/
if (err || (err = catch(errstring = error(1))))
werror(describe_backtrace(err));
else if (sizeof(errstring))
werror(errstring);
} }
final void _connectfail(void|mixed err) { final void _connectfail(void|mixed err) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment