Skip to content

Commit 850b559

Browse files
authored
[ml] UnExpectedNonPipelineParameterTypeError to UserErrorException (Azure#27344)
* back to UserErrorException * revert recordings
1 parent 14ce50e commit 850b559

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

sdk/ml/azure-ai-ml/azure/ai/ml/dsl/_pipeline_decorator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
UnsupportedParameterKindError,
2626
UserErrorException,
2727
ParamValueNotExistsError,
28-
UnExpectedNonPipelineParameterTypeError,
2928
)
3029

3130
from ._pipeline_component_builder import PipelineComponentBuilder, _is_inside_dsl_pipeline_func
@@ -227,7 +226,8 @@ def _validate_args(func, args, kwargs, non_pipeline_inputs):
227226
"""Validate customer function args and convert them to kwargs."""
228227
if not isinstance(non_pipeline_inputs, List) or \
229228
any(not isinstance(param, str) for param in non_pipeline_inputs):
230-
raise UnExpectedNonPipelineParameterTypeError()
229+
msg = "Type of 'non_pipeline_parameter' in dsl.pipeline should be a list of string"
230+
raise UserErrorException(message=msg, no_personal_data_message=msg)
231231
# Positional arguments validate
232232
all_parameters = [param for _, param in signature(func).parameters.items()]
233233
# Implicit parameter are *args and **kwargs

sdk/ml/azure-ai-ml/azure/ai/ml/exceptions.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -580,14 +580,6 @@ def __init__(self, func_name, keywords):
580580
super().__init__(message=message, no_personal_data_message=message)
581581

582582

583-
class UnExpectedNonPipelineParameterTypeError(UserErrorException):
584-
"""Exception raised when non_pipeline_parameter type is not List[str]."""
585-
586-
def __init__(self):
587-
message = "Type of 'non_pipeline_parameter' in dsl.pipeline should be a list of string"
588-
super().__init__(message=message, no_personal_data_message=message)
589-
590-
591583
class UnsupportedOperationError(UserErrorException):
592584
"""Exception raised when specified operation is not supported."""
593585

sdk/ml/azure-ai-ml/tests/dsl/unittests/test_dsl_pipeline.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from azure.ai.ml.entities._builders import Command
3030
from azure.ai.ml.entities._job.pipeline._io import PipelineInput
3131
from azure.ai.ml.entities._job.pipeline._load_component import _generate_component_function
32-
from azure.ai.ml.exceptions import UserErrorException, ValidationException, ParamValueNotExistsError, UnExpectedNonPipelineParameterTypeError
32+
from azure.ai.ml.exceptions import UserErrorException, ValidationException, ParamValueNotExistsError
3333

3434
from .._util import _DSL_TIMEOUT_SECOND
3535

@@ -2058,7 +2058,7 @@ def test_pipeline_with_invalid_non_pipeline_inputs(self):
20582058
def pipeline_func():
20592059
pass
20602060

2061-
with pytest.raises(UnExpectedNonPipelineParameterTypeError) as error_info:
2061+
with pytest.raises(UserErrorException) as error_info:
20622062
pipeline_func()
20632063
assert "Type of 'non_pipeline_parameter' in dsl.pipeline should be a list of string" in str(error_info)
20642064

0 commit comments

Comments
 (0)