[Bioc-devel] Error during wrapup, what does this mean?

Dipl.-Ing. Johannes Rainer johannes.rainer at tugraz.at
Fri May 20 16:45:29 CEST 2005


i agree with this. but what if the user types <ctrl>+c during the call? 
i assume that try and tryCatch will not work in this cases, as i want 
also roll back a transaction when the user breaks the operation by 
himself.
currently i have solved the problem in the following way:
with options(error=expression(.rollItBack()))

and during the function call i copy the connection parameter to a 
global variable called 'ErrorConnection' which is used by the 
rollItBack function. on the 'on.exit' i reset the options(error=NULL) 
and remove the 'ErrorConnection' from the global environment...

jo

Quoting Robert Gentleman <rgentlem at fhcrc.org>:

> James W. MacDonald wrote:
>> Dipl.-Ing. Johannes Rainer wrote:
>>
>>> hi, it's again me, but i found the problem...
>>> as i am working with database connections and if an error occurs in 
>>> a function call i want to roll back the whole stuff that has been 
>>> written into a database, i thought to be smart and defined with
>>>
>>>> options(error=expression(.rollItBack(Con)))
>>>
>>>
>>>
>>> where .rollItBack is a function that sends the command ROLLBACK 
>>> TRANSACTION to the database. well, i did not think, that when the 
>>> error occurs the object Con, which is a local variable in the 
>>> function does not exist, unless the user has called the connection 
>>> object also 'Con'.
>>>
>>> now i want to ask how i can define a global variable from within a 
>>> function.
>>
>>
>> See ?"<<-" and ?assign
>>
>> HTH,
>>
>> Jim
>>
>
> Hi,
>
>   But it is generally not a good idea to do it that way. If users 
> have connections that you are using then they should be parameters to 
> the functions that you are using and using try, or tryCatch, will 
> generally be much better. I would also like to point out that if I 
> understand this, then any error the user makes will roll-back a 
> transaction - typing the wrong name for a function etc. That is 
> probably not a good design decision.
>
>   Robert
>
>
>
>>
>>>
>>> cheers, jo
>>>
>>> Quoting "Dipl.-Ing. Johannes Rainer" <johannes.rainer at tugraz.at>:
>>>
>>>> hi,
>>>> i am getting the error message:
>>>>
>>>>> Error during wrapup: Object "Con" not found
>>>>
>>>>
>>>>
>>>> in my functions and have no idea from where this message comes (i 
>>>> have renamed some function arguments from 'Con' to 'con', maybe 
>>>> the message comes from there :) ). nevertheless i do not know 
>>>> where i should search for this error (as the functions work like 
>>>> they should...). can anybody tell me more to this error message?
>>>>
>>>> cheers, jo
>>>>
>>>> _______________________________________________
>>>> Bioc-devel at stat.math.ethz.ch mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>>>>
>>>
>>> _______________________________________________
>>> Bioc-devel at stat.math.ethz.ch mailing list
>>> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>>
>>
>>
>
>



More information about the Bioc-devel mailing list