[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] Some unhandled exceptions, also console output

From: Karsten Hilbert
Subject: Re: [Gnumed-devel] Some unhandled exceptions, also console output
Date: Tue, 29 Jun 2010 11:45:23 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

On Mon, Jun 28, 2010 at 10:10:48PM -0700, Jim Busser wrote:

> I generated two reports (as jim @ ca) to gnumed-bugs. If
> those could be consulted, I assume that they reflect excess
> inactivity, and I just wondered whether such errors (or a
> subset thereof) -- if identifiable with some confidence
> --could in future be more cleanly "trapped" and presented to
> the user as a dialog that says:
>       While you were last working on patient <name>, your database connection 
> timed out. This GNUmed session is now expired.
>       <ok button>

I added this logic:

        # lost connection ?
                msg = gmPG2.extract_message_from_pg_exception(exc = v)
                msg = u'cannot extract msg from PostgreSQL exception'
                print msg
                print v

        conn_loss_on_operational_error = (
                (t == gmPG2.dbapi.OperationalError)
                ('erver' in msg)
                (('term' in msg) or ('abnorm' in msg) or ('end' in msg))
        conn_loss_on_interface_error = (
                (t == gmPG2.dbapi.InterfaceError)
                ('onnect' in msg)
                (('close' in msg) or ('end' in msg))
        lost_connection = conn_loss_on_operational_error or 
        if lost_connection:
                gmGuiHelpers.gm_show_error (
                        aTitle = _('Lost connection'),
                        aMessage = _(
                                'Since you were last working in GNUmed,\n'
                                'your database connection timed out.\n'
                                'This GNUmed session is now expired.\n'
                                'You will have to close this client and\n'
                                'restart a new GNUmed session.'
                _log2.panic('lost connection')

(we don't know the patient name at this point in the code and
 we should not try to find out lest we provoke follow-on

which will show the attached friendly screenshot.

GPG key ID E4071346 @
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

Attachment: screenshot_001.png
Description: PNG image

reply via email to

[Prev in Thread] Current Thread [Next in Thread]