[Zope-dev] Trapping Interbase Error Codes

Brad Clements bkc@murkworks.com
Sat, 9 Mar 2002 14:00:22 -0500


On 8 Mar 2002 at 20:58, Dieter Maurer wrote:

> Beverly Dolor writes:
>  > I'm currently doing a program on Zope 2.5 using gvibDa
>  > as my database.  I would like my program to trap
>  > Interbase error codes such as (isc_deadlock,
>  > isc_lock_conflict), the problem is I'm still at a lost
>  > on how to do this. 
> How are these errors shown to you?
> 
> I do not know Interbase and the corresponding adapters.
> For Oracle (DCOracle2), Oracle errors are mapped onto a standard
> exception, but the exception detail contains the Oracle error number.
> Thus, looking at this number, I would be able to provide
> error specific information.

Checking specific error codes from within Zope is a PITA because of access control on 
the Exception object.

You'll need to modify gvibExceptions.py, add doc strings to     def getSqlCode(self) and 
other methods.. And probably add

    __roles__=None
    __allow_access_to_unprotected_subobjects__=1

hack lines to Exception class defs.

OTH, if you use an external method to process the gvib request, or create an external 
method that can extract the sqlCode for you.. then you wouldn't need these mods.

def getSqlCode(exceptionObject):
    """Return the sqlcode"""
    return exceptionObject.getSqlCode()


Then when you get an exception, pass the exception object to the external method to 
get the sqlcode.



Brad Clements,                bkc@murkworks.com   (315)268-1000
http://www.murkworks.com                          (315)268-9812 Fax
AOL-IM: BKClements