# errors

Python API: `hubai_sdk.errors`

HubAI API 和用户输入失败引发的异常。

服务函数将 HTTP 失败转换为此层次结构，因此调用者无需检查状态代码。捕获
[HubApiError](/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/errors.md) 以处理每个远程 API
失败，或者在其子类之一中处理，当恢复取决于原因时。

## 类

### HubApiError

HubAI API 报告的错误的基异常。

#### 方法

##### init

```python
def __init__(message: str, *, status_code: int | None = None):
```

#### 属性

##### status_code

HubAI 返回的 HTTP 状态码（如果可用）。

### InputError

当 SDK 输入不完整或内部不一致时引发。

### ResourceAmbiguousError

当标识符匹配多个 HubAI 资源时引发。

#### 方法

##### init

```python
def __init__(identifier: str, endpoint: str):
```

#### 属性

##### endpoint

##### identifier

### ResourceConflictError

当操作与现有资源冲突时引发。

### ResourceNotFoundError

当请求的 HubAI 资源无法解析时引发。

#### 方法

##### init

```python
def __init__(identifier: str, endpoint: str):
```

#### 属性

##### endpoint

搜索的 API 资源集合。

##### identifier

无法解析的 ID、原始 slug 或资源路径。

### ValidationError

当 HubAI 拒绝请求字段或值时引发。
