Shadow and I discussed this once. He knows more about it than I do, so he'd be the person to properly answer this question.
However, in my attempt to assist you, I think the function you are looking for is:
seterrorhandler( );
Or something to that effect.
EDIT: I forgot to add that there is one parameter to this function, which is the function that needs to be called on an error.