The (setq *error* temperr) line is supposed to return the error trap to the original function, stored in temperr. Besides being pretty useless, I noticed the (princ) call at the end was causing a bug - the original error trap was not restored.
I am wondering how exactly it happens that having the (princ) line causes this. It is my understanding that the last function evaluated is what is returned from a function, and that calling (princ) returns nil. But why doesn't the side effect of (setq *error* temperr) still happen?