better error handling in test