AutoMLException 类

带有指定错误类型的附加字段的异常。

继承
azureml._common.exceptions.AzureMLException
AutoMLException

构造函数

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

参数

exception_message
target
默认值: None
details
默认值: None
message_format
默认值: None
message_parameters
默认值: None
reference_code
默认值: None
has_pii
默认值: True
azureml_error
默认值: None
inner_exception
默认值: None

方法

create_without_pii

创建标记为不包含 PII 的异常。

from_exception

将任意异常转换为此异常类型。 生成的异常标记为包含 PII。

get_pii_free_exception_msg_format
pii_free_msg

在不适合打印包含 PII 的信息的情况下使用的回退消息。

with_generic_msg

附加一条通用错误消息,如果此异常包含 PII,则将在遥测中使用该消息。

create_without_pii

创建标记为不包含 PII 的异常。

create_without_pii(msg: str = '', target: Optional[str] = None, reference_code: Optional[str] = None) -> ExceptionT

参数

cls
必需

type :class: 类:azureml.automl.core.exceptions.AutoMLException

msg
必需

使用可选消息,而不是原始异常消息

target
默认值: None

指向异常目标的可选字符串

reference_code
默认值: None

发生故障的模块或代码的指示器

from_exception

将任意异常转换为此异常类型。 生成的异常标记为包含 PII。

from_exception(e: BaseException, msg: Optional[str] = None, target: Optional[str] = None, reference_code: Optional[str] = None, has_pii: bool = True) -> azureml.automl.core.shared.exceptions.AutoMLException

参数

cls
必需

type :class: 类:azureml.automl.core.exceptions.AutoMLException

e
必需

原始异常对象

msg
默认值: None

使用可选消息,而不是原始异常消息

target
默认值: None

指向异常目标的可选字符串

reference_code
默认值: None

发生故障的模块或代码的指示器

has_pii
默认值: True

此异常是否包含 PII

返回

此类型的新异常,保留原始堆栈跟踪

get_pii_free_exception_msg_format

get_pii_free_exception_msg_format() -> str

pii_free_msg

在不适合打印包含 PII 的信息的情况下使用的回退消息。

pii_free_msg(scrubbed: bool = True) -> str

参数

scrubbed
默认值: True

如果为 True,则返回泛型“[隐藏,因为它可能包含 PII]”作为回退,否则返回空字符串

返回

记录遥测的日志记录的安全消息

with_generic_msg

附加一条通用错误消息,如果此异常包含 PII,则将在遥测中使用该消息。

with_generic_msg(msg: str) -> ExceptionT

参数

msg
必需

要使用的通用消息

返回

此对象

属性

error_code

获取此异常的错误代码。

error_type

获取此异常的根错误类型。

has_pii

检查此异常的消息是否包含 PII。

message_format

获取日志安全异常消息(如果有)。

target

导致引发异常的元素名称。