Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions docs/en/api/errors/lynx-error.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,43 @@ It contains both machine-readable information (error code, subcode, severity) an

## Overview

```java
public int getErrorCode()
```

Return the error code. The error code is a 3 to 4-digit number used to denote the behavior of the error. For example, code 301 indicates a loading error for image. You can refer to documentation [Error Codes](/api/errors/error-code) to learn the specific behavior each error code represents.

#### getSubCode

```java
public int getSubCode()
```

Return the error subcode. The error subcode is a 5 to 6-digit number derived from extending the error code by 2 digits. The error subcode is used to indicate the cause of the error. For example, subcode 30101 indicates that the loaded image is too large. You can refer to documentation [Error Codes](/api/errors/error-code) to learn the specific cause each error subcode represents.

#### isFatal

```java
public boolean isFatal()
```

Determine if the error level is `Fatal`. `LynxError` has three levels: `Fatal`, `Error`, and `Warn`. `Fatal` indicates a critical error that might cause the Lynx page to go blank, requiring the integrator to perform fallback handling; for example, attempting to reload the Lynx page or displaying an error page. `Error` denotes a non-critical error that might cause some functionalities of the Lynx page to become unavailable. `Warn` signifies a warning error that does not affect the functionality of the Lynx page but should be addressed if possible. You can refer to documentation [Error Codes](/api/errors/error-code) to learn about the error levels associated with each subcode. If the level is `Undecided`, it means that the error level for that subcode is determined at runtime.

#### getMsg

```java
public boolean getMsg()
```

Return all error information in JSON string format, including the code, subcode, error message, level, and fix suggestion.

## iOS

#### errorCode

```objective-c
- (NSInteger)errorCode
```
| Property | Type | Description |
| ------------ | -------- | ----------------------------------------------------- |
| `errorCode` | `int` | Top-level error code (e.g. 102) |
Expand Down
37 changes: 37 additions & 0 deletions docs/zh/api/errors/lynx-error.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,43 @@

## 总览

```java
public int getErrorCode()
```

返回错误码。错误码是一个 3 到 4 位的数字,用于表示错误的行为。例如 301 表示图片加载错误。你可以通过文档[错误码](/api/errors/error-code)来了解每个错误码代表的错误行为。

#### getSubCode

```java
public int getSubCode()
```

返回错误子码。错误子码是一个 5 到 6 位的数字,由错误码拓展 2 位而来。错误子码用于表示错误的原因。例如 30101 表示加载的图片过大。你可以通过文档[错误码](/api/errors/error-code)来了解每个错误子码代表的错误原因。

#### isFatal

```java
public boolean isFatal()
```

判断错误的级别是否为 `Fatal`。`LynxError` 有 `Fatal`、`Error`、`Warn` 三种级别,其中 `Fatal` 表示致命错误,可能导致 Lynx 页面白屏,需要接入方进行降级处理,例如尝试重新加载 Lynx 页面、展示兜底的错误页面等;`Error` 表示非致命错误,可能导致 Lynx 页面部分功能不可用;`Warn` 表示警告错误,不影响 Lynx 页面的功能,但仍建议尽量修复。你可以通过文档[错误码](/api/errors/error-code)来了解每个错误子码的错误级别,如果为 `Undecided`,则代表该错误子码的错误级别在运行时绑定。

#### getMsg

```java
public boolean getMsg()
```

以 JSON 字符串的形式返回错误的所有信息,包括错误码、错误子码、错误描述、错误级别、修复建议等。

## iOS

#### errorCode

```objective-c
- (NSInteger)errorCode
```
| 属性 | 类型 | 描述 |
| ------------ | -------- | --------------------------------------------------- |
| `errorCode` | `int` | 顶级错误码 (e.g. 102) |
Expand Down