in reply to how to return info from functions
Maybe an other approach is interesting for you too. See Best Practices for Exception Handling