catch exceptions and test