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

#### 产品支持情况

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


#### 功能说明

获取当前线程的Runtime（运行时管理模块）错误码，仅获取但不清空错误码。


#### 函数原型

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

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


#### 参数说明

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


#### 返回值说明

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