RE: [cx-oracle-users] best way to get oracle error number from exception?
Brought to you by:
atuining
From: Guido v. R. <gu...@el...> - 2005-10-24 21:56:03
|
> try: > cursor.execute("select 1 / 0 from dual") > except cx_Oracle.DatabaseError, e: > print "Exception:", e # this is what you are looking at=20 > right now > errorObj, =3D e.args # this is the actual "error"=20 This is overly subtle. Why not write errorObj =3D e.args[0] ? I can't think of a situation where that wouldn't work and the former would. > that cx_Oracle raises > print "ErrorCode:", errorObj.code > print "ErrorMessage:", errorObj.message --Guido van Rossum |