AutoMLException Class

Exception with an additional field specifying what type of error it is.

Construct a new AutoMLException.

Inheritance
azureml._common.exceptions.AzureMLException
AutoMLException

Constructor

AutoMLException(exception_message: str = '', target: str | None = None, details: List[str] | None = None, message_format: str | None = None, message_parameters: Dict[str, str] | None = None, reference_code: str | None = None, has_pii: bool = True, azureml_error: AzureMLError | None = None, inner_exception: BaseException | None = None)

Parameters

Name Description
exception_message
Required
str

A message describing the error.

target
str

The name of the element that caused the exception to be thrown.

default value: None
details

Any additional information for the error, such as other error responses or stack traces.

default value: None
message_format
str

Un-formatted version of the exception_message with no variable substitution.

default value: None
message_parameters
<xref:Dictionary>[str, str]

Value substitutions corresponding to the contents of message_format

default value: None
reference_code
str

Indicator of the module or code where the failure occurred

default value: None
has_pii

Boolean representing whether the Exception message has any PII information.

default value: True
azureml_error
default value: None
inner_exception
default value: None

Methods

create_without_pii

Create an exception that is tagged as not containing PII.

from_exception

Convert an arbitrary exception to this exception type. The resulting exception is marked as containing PII.

get_pii_free_exception_msg_format
pii_free_msg

Fallback message to use for situations where printing PII-containing information is inappropriate.

with_generic_msg

Attach a generic error message that will be used in telemetry if this exception contains PII.

create_without_pii

Create an exception that is tagged as not containing PII.

create_without_pii(msg: str = '', target: str | None = None, reference_code: str | None = None) -> ExceptionT

Parameters

Name Description
cls
Required

Class of type :class: azureml.automl.core.exceptions.AutoMLException

msg
Required

optional message to use instead of the original exception message

target

optional string pointing to the target of the exception

default value: None
reference_code

Indicator of the module or code where the failure occurred

default value: None

from_exception

Convert an arbitrary exception to this exception type. The resulting exception is marked as containing PII.

from_exception(e: BaseException, msg: str | None = None, target: str | None = None, reference_code: str | None = None, has_pii: bool = True) -> AutoMLException

Parameters

Name Description
cls
Required

Class of type :class: azureml.automl.core.exceptions.AutoMLException

e
Required

the original exception object

msg

optional message to use instead of the original exception message

default value: None
target

optional string pointing to the target of the exception

default value: None
reference_code

Indicator of the module or code where the failure occurred

default value: None
has_pii

whether this exception contains PII or not

default value: True

Returns

Type Description

a new exception of this type, preserving the original stack trace

get_pii_free_exception_msg_format

get_pii_free_exception_msg_format() -> str

pii_free_msg

Fallback message to use for situations where printing PII-containing information is inappropriate.

pii_free_msg(scrubbed: bool = True) -> str

Parameters

Name Description
scrubbed

If true, return a generic '[Hidden as it may contain PII]' as a fallback, else an empty string

default value: True

Returns

Type Description

Log safe message for logging in telemetry

with_generic_msg

Attach a generic error message that will be used in telemetry if this exception contains PII.

with_generic_msg(msg: str) -> ExceptionT

Parameters

Name Description
msg
Required

the generic message to use

Returns

Type Description

this object

Attributes

error_code

Get the error code for this exception.

error_type

Get the root error type for this exception.

has_pii

Check whether this exception's message contains PII or not.

message_format

Get a log safe exception message, if any.

target

Name of the element that caused the exception to be thrown.