Test validate_with_exception