> For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt.

# onReceivedError

APISummary
收到后台运行时中的错误时调用，错误可能来自 JS 或 Native（C++）。

## 语法

### Android

```java
public void onReceivedError(LynxError error);
```

#### 参数

- `error`: 错误信息。

### iOS

```objc
- (void)runtime:(LynxBackgroundRuntime *)runtime didReceiveError:(NSError *)error;
```

#### 参数

- `error`: 错误信息。

## 兼容性

**Compatibility Table**

**Query:** `lynx-native-api.lynx-background-runtime-client.on-received-error`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/lynx-native-api/lynx-background-runtime-client/on-received-error.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| on-received-error | Yes (3.1) | Yes (3.4) | Yes (3.1) | No | No | No |

**`on-received-error`**

Called when an error is received in background runtime.

**Specifications:**

