in reply to avoiding error message

 The real solution to this problem I'm sure is to fix your code to test errors and handle things gracefully.

 But if you want to do the redirect on error you could do this by catching "warn" and "die" errors - and doing the redirect there.

Steve
---
steve.org.uk