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 <phd@phdru.name>
On Thu, Sep 12, 2013 at 03:33:36PM -0300, Francisco Chiotta <franchiotta@gmail.com> 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/            phd@phdru.name
           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
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss