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