模块 exceptions

exceptions 模块提供了一个用于在平台内处理错误的标准框架。它包含针对操作、连接器、作业和 Google Cloud 操作的专用异常类,使开发者能够精确捕获并响应特定的失败场景。

以下示例演示了如何从该模块导入并引发特定错误:

from TIPCommon.exceptions import ConnectorProcessingError
raise ConnectorProcessingError('spam and eggs')

操作例外

这些异常用于处理从初始化到数据报告的整个操作生命周期内发生的错误。

例外情况
GeneralActionException 基地:Exception

用作所有与操作相关的异常的基类。

ActionSetupError 基地:GeneralActionException

表示在初始化操作期间发生了错误。

CaseResultError 基地:GeneralActionException

在将数据发送到案例结果时发生错误。

EnrichActionError 基地:GeneralActionException

在丰富操作中发生错误时出现。

SDKWrapperError 基地:GeneralActionException

当 SDK 方法封装容器中发生错误时触发。

JobSetupError 基地:GeneralActionException

表示作业初始化错误。

连接器异常

这些异常专门用于管理与数据连接器及其处理逻辑相关的故障状态。

例外情况
GeneralConnectorException 基础:Exception

充当所有连接器相关异常的基类。

ConnectorSetupError 基础:GeneralConnectorException

表示连接器初始化期间发生故障。

ConnectorContextError 基础:GeneralConnectorException

表示连接器上下文中存在错误。

ConnectorProcessingError 基础:GeneralConnectorException

表示连接器在数据处理阶段发生故障。

ConnectorValidationError 基础:GeneralConnectorException

表示连接器遇到验证错误。

Google Cloud 个例外情况

这些异常会映射到与Google Cloud 资源互动时遇到的特定错误状态。

例外情况
GoogleCloudException 基地:Exception

充当 Google Cloud 错误的常规基类。

AlreadyExistsError 基地:GoogleCloudException

当 Google Cloud 资源已存在时发生。

NotFoundError 基地:GoogleCloudException

当找不到 Google Cloud 资源时会发生此情况。

PermissionDeniedError 基地:GoogleCloudException

当客户端缺少对资源执行相应操作的权限时发生。

UnauthenticatedError 基地:GoogleCloudException

当客户端未正确进行身份验证时发生。

DeadlineExceededError 基地:GoogleCloudException

当请求未在分配的时间内完成时发生。

ResourceExhaustedError 基地:GoogleCloudException

表示云项目的配额已超出,或者客户端同时发出的请求过多。

BadGatewayError 基地:GoogleCloudException

表示客户端与后端 Google Cloud 服务器之间的某个服务器检测到临时问题。

UnavailableError 基地:GoogleCloudException

表示 Google Cloud 服务无法处理请求。

InvalidArgumentError 基地:GoogleCloudException

表示对 Google Cloud 资源的请求无效。

FailedPreconditionError 基地:GoogleCloudException

表示针对 Google Cloud 请求的先决条件失败错误。

ImpersonationUnauthorizedError 基地:GoogleCloudException

表示调用方无权模拟服务账号。

常规和实用程序例外情况

此部分包含有关内容中心集成中一般系统错误、参数验证和专门数据处理的异常。

例外情况
ParameterValidationError 基地:Exception

当参数无效时引发。

EmptyMandatoryValues 基地:Exception

表示空必填值的异常。

ParameterExtractionError 基地:Exception

表示参数提取错误。

OauthError 基地:Exception

当 OAuth 2.0 流程中发生一般性异常时引发。

SMIMEMailError 基地:Exception

表示 S/MIME 电子邮件处理错误的自定义异常。

InternalJSONDecoderError 基地:Exception

表示使用 json.loadjson.dump 时出现内部 JSON 解析错误。

InvalidTimeException 基地:Exception

表示时间无效的异常。

NotSupportedPlatformVersion 基地:Exception

表示不支持的平台版本错误的自定义异常。

GeneralJobException 基地:Exception

用作与作业相关的异常的一般基类。

RefreshTokenRenewalJobException 基地:GeneralJobException

表示 RefreshTokenRenewalJob 实例中存在失败。