error handling with test