---
title: 函数：get_last_error
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/runtimeapi/aclpythondevg_01_1078.html
sourcePath: /source/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_1078.html
indexId: 6cc3837964feec9ea7b154c208d8109e7ffb7d3b03df22d1bb9d3dc4e6c54bf471
---
# 函数：get_last_error

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | √ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 训练系列产品 | √ |
| Atlas 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | √ |


#### 功能说明

获取当前线程的Runtime（运行时管理模块）错误码，获取后清空当前线程的错误码，这时在线程中无新增错误码之前，调用本接口获取到的是表示成功的返回码ACL_SUCCESS。


#### 函数原型

- C函数原型
  1 aclError aclrtGetLastError(aclrtLastErrLevel level)

- python函数
  1 ret = acl.rt.get_last_error(level)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| level | int，指定获取错误码的级别，当前仅支持线程级别。参考aclrtLastErrLevel |


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| ret | int，返回0表示成功，返回非0表示失败。 |
