> For the complete documentation index, see [llms.txt](https://smallso.gitbook.io/tencent-cloud-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://smallso.gitbook.io/tencent-cloud-sdk/python-docs/other-products/class-and-method/error-manager/has-handler.md).

# has\_handler 方法

## 简要

检查给定错误处理器回调函数是否已添加到错误处理器的错误处理程序链。

```python
def has_handler(self,
    error_handler: object
)
```

## 参数

该方法具有以下参数，其参数、参数类型和参数描述如下：

| 参数             | 类型       | 必选 | 描述            |
| -------------- | -------- | -- | ------------- |
| error\_handler | function | 是  | 检查的错误处理器回调函数。 |

## 返回值

如果给定错误处理器回调函数存在，则返回 `True`，否则返回 `False`。

## 异常

该方法可能会主动引发以下异常类型：

#### ValueError

参数值或类型不符合预期。

## 示例

接下来我们将通过一段 Python 代码向您演示如何使用该方法：

```python
def error_handler_callback(
    error_manager: errors.ErrorManager,
    error_source: client.BaseClient,
    error_instance: errors.ActionError,
    error_retry_count: int
) -> int:
    if not isinstance(error_instance, errors.ActionError):
        return errors.ErrorHandlerResult.Ignore
    
    if error_instance.action_id == 'FailedOperation':
        return errors.ErrorHandlerResult.Backoff
    else:
        return errors.ErrorHandlerResult.Throw

function_client.error_manager.has_handler(
    error_handler = error_handler_callback
)
```

## 适用于

#### Tencent Cloud SDK for Python

基础软件包：tencent-cloud-sdk-core >= 0.1.2
