[development] Hmm how to solve this nicely?

Piotr Krukowiecki piotr at mallorn.ii.uj.edu.pl
Fri Mar 10 21:14:35 UTC 2006


Hi, 

I have a problem with a bug. It needs a general solution. 

The problem lies in error_handler() function. Sometimes it needs to do
"additional" stuff before doing insert into watchdog.

Generally it looks like this:

... some queries here ...
1. now a query that goes bad. This issues error_handler()
2. error handler does INSERT INTO {watchdog}
... control goes back to the place when the error happened

Sometimes between 1. and 2. extra actions need to be performed. That is,
you can not do the INSERT right away.

For example, in http://drupal.org/node/39460 you need to do ROLLBACK.
In http://drupal.org/node/53420 you need to do pg_end_copy().
In theory you might have to do both pg_end_copy() and ROLLBACK.

But there is at least one extra problem. User can call error handler by
himself with trigger_error(). The error handler can spawned by PHP error. 
In those two cases, we should not do the ROLLBACK.

How to differentiate between those two cases and "legitimate" case when
we should do some action? Is it possibile at all?
How to write it cleanly?


-- 
Piotrek
irc: #debian.pl
Mors Drosophilis melanogastribus!


More information about the development mailing list