Re: Connection errors
Francisco Chiotta <[email protected]> Thu, 12 Sep 2013 16:43:09 -0300
| Newsgroups | gmane.comp.python.sqlobject |
|---|---|
| Message-ID | <CAGSr3a0ReyQDKxLsZdVL7tOWnk=8g9_9SYe7Ux_RwNJVJC+t+w@mail.gmail.com> |
Ok, I thought that It was possible to recover an error code or something like that. Thank you for your help. 2013/9/12 Oleg Broytman <[email protected]> > On Thu, Sep 12, 2013 at 03:33:36PM -0300, Francisco Chiotta < > [email protected]> wrote: > > Thank you, but I need to distinguish the errors in the except statement, > > something like that: > > > > try: > > connection = connectionForURI('postgres://'+user+':'+password+'@ > > '+host+'/'+database?debug=True) > > sqlhub.processConnection = connection > > connection.query("SELECT 1") > > except OperationalError, e: > > if (user or password are incorrect): > > show a message > > elif (the server is not working): > > to do another thing > > ... > > > > How can I ask the OperationalError object 'e' to do that? > > I don't think database drivers provide such information. You can try > to parse the error message, but they are very database- and > locale-dependent. > > Oleg. > -- > Oleg Broytman http://phdru.name/ [email protected] > Programmers don't die, they just GOSUB without RETURN. > > > ------------------------------------------------------------------------------ > How ServiceNow helps IT people transform IT departments: > 1. Consolidate legacy IT systems to a single system of record for IT > 2. Standardize and globalize service processes across IT > 3. Implement zero-touch automation to replace manual, redundant tasks > http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk > _______________________________________________ > sqlobject-discuss mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > ------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. Consolidate legacy IT systems to a single system of record for IT 2. Standardize and globalize service processes across IT 3. Implement zero-touch automation to replace manual, redundant tasks http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk _______________________________________________ sqlobject-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss