Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
d82d7d39
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
d82d7d39
编写于
2月 09, 2023
作者:
O
openharmony_ci
提交者:
Gitee
2月 09, 2023
浏览文件
操作
浏览文件
下载
差异文件
!14405 Update ErrorCode
Merge pull request !14405 from Yangys/master
上级
4551161b
ae19f450
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
1117 addition
and
14 deletion
+1117
-14
zh-cn/application-dev/reference/apis/js-apis-http.md
zh-cn/application-dev/reference/apis/js-apis-http.md
+93
-14
zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md
zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md
+86
-0
zh-cn/application-dev/reference/apis/js-apis-net-sharing.md
zh-cn/application-dev/reference/apis/js-apis-net-sharing.md
+240
-0
zh-cn/application-dev/reference/apis/js-apis-socket.md
zh-cn/application-dev/reference/apis/js-apis-socket.md
+12
-0
zh-cn/application-dev/reference/apis/js-apis-webSocket.md
zh-cn/application-dev/reference/apis/js-apis-webSocket.md
+84
-0
zh-cn/application-dev/reference/errorcodes/Readme-CN.md
zh-cn/application-dev/reference/errorcodes/Readme-CN.md
+2
-0
zh-cn/application-dev/reference/errorcodes/errorcode-http.md
zh-cn/application-dev/reference/errorcodes/errorcode-http.md
+523
-0
zh-cn/application-dev/reference/errorcodes/errorcode-socket.md
.../application-dev/reference/errorcodes/errorcode-socket.md
+77
-0
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-http.md
浏览文件 @
d82d7d39
...
...
@@ -103,6 +103,21 @@ request\(url: string, callback: AsyncCallback\<HttpResponse\>\):void
| url | string | 是 | 发起网络请求的URL地址。 |
| callback | AsyncCallback
\<
[
HttpResponse
](
#httpresponse
)
\>
| 是 | 回调函数。 |
**错误码:**
| 错误码ID | 错误信息 |
|---------|-------------------------------------------------------|
| 401 | Parameter error. |
| 2300003 | URL using bad/illegal format or missing URL. |
| 2300007 | Couldn't connect to server. |
| 2300028 | Timeout was reached. |
| 2300052 | Server returned nothing (no headers, no data). |
| 2300999 | Unknown Other Error. |
>**错误码说明:**
> 以上错误码的详细介绍参见[HTTP错误码](../errorcodes/errorcode-http.md)。
> HTTP 错误码映射关系:2300000 + curl错误码。更多常用错误码,可参考:[curl错误码](https://curl.se/libcurl/c/libcurl-errors.html)
**示例:**
```
js
...
...
@@ -136,6 +151,45 @@ request\(url: string, options: HttpRequestOptions, callback: AsyncCallback<HttpR
| options | HttpRequestOptions | 是 | 参考
[
HttpRequestOptions
](
#httprequestoptions
)
。 |
| callback | AsyncCallback
\<
[
HttpResponse
](
#httpresponse
)
\>
| 是 | 回调函数。 |
**错误码:**
| 错误码ID | 错误信息 |
|---------|-------------------------------------------------------|
| 401 | Parameter error. |
| 2300001 | Unsupported protocol. |
| 2300003 | URL using bad/illegal format or missing URL. |
| 2300005 | Couldn't resolve proxy name. |
| 2300006 | Couldn't resolve host name. |
| 2300007 | Couldn't connect to server. |
| 2300008 | Weird server reply. |
| 2300009 | Access denied to remote resource. |
| 2300016 | Error in the HTTP2 framing layer. |
| 2300018 | Transferred a partial file. |
| 2300023 | Failed writing received data to disk/application. |
| 2300025 | Upload failed. |
| 2300026 | Failed to open/read local data from file/application. |
| 2300027 | Out of memory. |
| 2300028 | Timeout was reached. |
| 2300047 | Number of redirects hit maximum amount. |
| 2300052 | Server returned nothing (no headers, no data). |
| 2300055 | Failed sending data to the peer. |
| 2300056 | Failure when receiving data from the peer. |
| 2300058 | Problem with the local SSL certificate. |
| 2300059 | Couldn't use specified SSL cipher. |
| 2300060 | SSL peer certificate or SSH remote key was not OK. |
| 2300061 | Unrecognized or bad HTTP Content or Transfer-Encoding.|
| 2300063 | Maximum file size exceeded. |
| 2300070 | Disk full or allocation exceeded. |
| 2300073 | Remote file already exists. |
| 2300077 | Problem with the SSL CA cert (path? access rights?). |
| 2300078 | Remote file not found. |
| 2300094 | An authentication function returned an error. |
| 2300999 | Unknown Other Error. |
>**错误码说明:**
> 以上错误码的详细介绍参见[HTTP错误码](../errorcodes/errorcode-http.md)。
> HTTP 错误码映射关系:2300000 + curl错误码。更多常用错误码,可参考:[curl错误码](https://curl.se/libcurl/c/libcurl-errors.html)
**示例:**
```
js
...
...
@@ -184,6 +238,44 @@ request\(url: string, options? : HttpRequestOptions\): Promise<HttpResponse\>
| :------------------------------------- | :-------------------------------- |
| Promise
<
[
HttpResponse
](
#httpresponse
)
>
| 以Promise形式返回发起请求的结果。 |
**错误码:**
| 错误码ID | 错误信息 |
|---------|-------------------------------------------------------|
| 401 | Parameter error. |
| 2300001 | Unsupported protocol. |
| 2300003 | URL using bad/illegal format or missing URL. |
| 2300005 | Couldn't resolve proxy name. |
| 2300006 | Couldn't resolve host name. |
| 2300007 | Couldn't connect to server. |
| 2300008 | Weird server reply. |
| 2300009 | Access denied to remote resource. |
| 2300016 | Error in the HTTP2 framing layer. |
| 2300018 | Transferred a partial file. |
| 2300023 | Failed writing received data to disk/application. |
| 2300025 | Upload failed. |
| 2300026 | Failed to open/read local data from file/application. |
| 2300027 | Out of memory. |
| 2300028 | Timeout was reached. |
| 2300047 | Number of redirects hit maximum amount. |
| 2300052 | Server returned nothing (no headers, no data). |
| 2300055 | Failed sending data to the peer. |
| 2300056 | Failure when receiving data from the peer. |
| 2300058 | Problem with the local SSL certificate. |
| 2300059 | Couldn't use specified SSL cipher. |
| 2300060 | SSL peer certificate or SSH remote key was not OK. |
| 2300061 | Unrecognized or bad HTTP Content or Transfer-Encoding.|
| 2300063 | Maximum file size exceeded. |
| 2300070 | Disk full or allocation exceeded. |
| 2300073 | Remote file already exists. |
| 2300077 | Problem with the SSL CA cert (path? access rights?). |
| 2300078 | Remote file not found. |
| 2300094 | An authentication function returned an error. |
| 2300999 | Unknown Other Error. |
>**错误码说明:**
> 以上错误码的详细介绍参见[HTTP错误码](../errorcodes/errorcode-http.md)。
> HTTP 错误码映射关系:2300000 + curl错误码。更多常用错误码,可参考:[curl错误码](https://curl.se/libcurl/c/libcurl-errors.html)
**示例:**
...
...
@@ -438,7 +530,7 @@ request方法回调函数的返回值类型。
| -------------------- | -------------------------------------------- | ---- | ------------------------------------------------------------ |
| result | string
\|
Object
\|
ArrayBuffer
<sup>
6+
</sup>
| 是 | HTTP请求根据响应头中Content-type类型返回对应的响应格式内容:
<br
/>
- application/json:返回JSON格式的字符串,如需HTTP响应具体内容,需开发者自行解析
<br
/>
- application/octet-stream:ArrayBuffer
<br
/>
- 其他:string |
| resultType
<sup>
9+
</sup>
|
[
HttpDataType
](
#httpdatatype9
)
| 是 | 返回值类型。 |
| responseCode |
[
ResponseCode
](
#responsecode
)
\|
number | 是 | 回调函数执行成功时,此字段为
[
ResponseCode
](
#responsecode
)
。若执行失败,错误码将会从AsyncCallback中的err字段返回。
错误码参考
[
Response错误码
](
#response常用错误码
)
。
|
| responseCode |
[
ResponseCode
](
#responsecode
)
\|
number | 是 | 回调函数执行成功时,此字段为
[
ResponseCode
](
#responsecode
)
。若执行失败,错误码将会从AsyncCallback中的err字段返回。 |
| header | Object | 是 | 发起HTTP请求返回来的响应头。当前返回的是JSON格式字符串,如需具体字段内容,需开发者自行解析。常见字段及解析方式如下:
<br/>
- Content-Type:header['Content-Type'];
<br
/>
- Status-Line:header['Status-Line'];
<br
/>
- Date:header.Date/header['Date'];
<br
/>
- Server:header.Server/header['Server']; |
| cookies
<sup>
8+
</sup>
| Array
\<
string
\>
| 是 | 服务器返回的 cookies。 |
...
...
@@ -572,19 +664,6 @@ httpResponseCache.delete().then(() => {
});
```
## Response常用错误码
| 错误码 | 说明 |
| ------ | ------------------------------------------------------------ |
| -1 | 参数错误。检查参数的个数与类型是否正确。 |
| 3 | URL格式错误。检查URL的格式与语法是否正确。 |
| 4 | 构建时无法找到内置的请求功能、协议或选项。一个功能或选项是不启用或明确禁用时,为了得到它的功能,你需要得到一个重建的libcurl。 |
| 5 | 无法解析代理,指定的代理服务器主机无法解析。建议排查:1、url地址是否正确。2、联网是否正常,网络是否可以和外部进行通信。3、是否有网络访问权限。 |
| 6 | 无法解析主机,指定的远程主机无法解析。建议排查:1、url地址是否正确。2、联网是否正常,网络是否可以和外部进行通信。3、是否有网络访问权限。 |
| 7 | 无法连接代理或主机。建议排查:1、端口号是否有问题。 2、查看本地是否开启http的代理影响的。 |
更多常用错误码,可参考:
[
curl错误码
](
https://curl.se/libcurl/c/libcurl-errors.html
)
。
## HttpDataType<sup>9+</sup>
http的数据类型。
...
...
zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md
浏览文件 @
d82d7d39
...
...
@@ -32,6 +32,19 @@ setIfaceConfig(iface: string, ic: InterfaceConfiguration, callback: AsyncCallbac
| ic |
[
InterfaceConfiguration
](
#interfaceconfiguration
)
| 是 | 要设置的网络接口配置信息 |
| callback | AsyncCallback
\<
void> | 是 | 回调函数,成功无返回,失败返回对应错误码。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
| 2201005 | The device information does not exist. |
| 2201006 | Device disconnected. |
| 2201007 | Failed to write the user configuration. |
**示例:**
```
js
...
...
@@ -71,6 +84,19 @@ setIfaceConfig(iface: string, ic: InterfaceConfiguration): Promise\<void>
| ------------------- | ----------------------------------------------------------- |
| Promise
\<
void> | 以Promise形式返回执行结果。成功无返回,失败返回对应错误码。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
| 2201005 | The device information does not exist. |
| 2201006 | Device disconnected. |
| 2201007 | Failed to write the user configuration. |
**示例:**
```
js
...
...
@@ -101,6 +127,17 @@ getIfaceConfig(iface: string, callback: AsyncCallback\<InterfaceConfiguration>):
| iface | string | 是 | 指定网络接口 |
| callback | AsyncCallback
\<
[
InterfaceConfiguration
](
#interfaceconfiguration
)
> | 是 | 回调函数,返回指定网络接口信息 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
| 2201005 | The device information does not exist. |
**示例:**
```
js
...
...
@@ -143,6 +180,17 @@ getIfaceConfig(iface: string): Promise\<InterfaceConfiguration>
| --------------------------------- | ---------------------------------- |
| Promise
\<
[
InterfaceConfiguration
](
#interfaceconfiguration
)
> | 以Promise形式返回接口信息。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
| 2201005 | The device information does not exist. |
**示例:**
```
js
...
...
@@ -178,6 +226,17 @@ isIfaceActive(iface: string, callback: AsyncCallback\<number>): void
| iface | string | 是 | 接口名。为空时代表查询是否存在激活接口 |
| callback | AsyncCallback
\<
number> | 是 | 回调函数,已激活:1,未激活:0,其他为获取失败错误码。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
| 2201005 | The device information does not exist. |
**示例:**
```
js
...
...
@@ -214,6 +273,17 @@ isIfaceActive(iface: string): Promise\<number>
| ----------------| ------------------------------------------------------------------ |
| Promise
\<
number> | 以Promise形式返回获取结果。已激活:1,未激活:0,其他为获取失败错误码。|
**错误码:**
| 错误码ID | 错误信息 |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
| 2201005 | The device information does not exist. |
**示例:**
```
js
...
...
@@ -242,6 +312,14 @@ getAllActiveIfaces(callback: AsyncCallback\<Array\<string>>): void
| -------- | ------------------------------------ | ---- | ------------------------------ |
| callback | AsyncCallback
\<
Array
\<
string>> | 是 | 回调函数,返回值为对应接口名。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
**示例:**
```
js
...
...
@@ -275,6 +353,14 @@ getAllActiveIfaces(): Promise\<Array\<string>>
| ------------------------------ | ----------------------------------------------- |
| Promise
\<
Array
\<
string>> | 以Promise形式返回获取结果。返回值为对应接口名。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | ----------------------------------------|
| 201 | Permission denied. |
| 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. |
**示例:**
```
js
...
...
zh-cn/application-dev/reference/apis/js-apis-net-sharing.md
浏览文件 @
d82d7d39
...
...
@@ -30,6 +30,15 @@ isSharingSupported(callback: AsyncCallback\<boolean>): void
| -------- | --------------------------------------- | ---- | ---------- |
| callback | AsyncCallback
\<
boolean> | 是 | 回调函数,返回true代表支持网络共享。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
| 2202011 | Cannot get network sharing configuration. |
**示例:**
```
js
...
...
@@ -57,6 +66,15 @@ isSharingSupported(): Promise\<boolean>
| --------------------------------- | ------------------------------------- |
| Promise
\<
boolean> | 以Promise形式返回是否支持共享结果。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
| 2202011 | Cannot get network sharing configuration. |
**示例:**
```
js
...
...
@@ -85,6 +103,14 @@ isSharing(callback: AsyncCallback\<boolean>): void
| -------- | --------------------------------------- | ---- | ---------- |
| callback | AsyncCallback
\<
boolean> | 是 | 回调函数,返回true代表网络共享中。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
**示例:**
```
js
...
...
@@ -112,6 +138,14 @@ isSharing(): Promise\<boolean>
| --------------------------------- | ------------------------------------- |
| Promise
\<
boolean> | 以Promise形式返回网络共享状态结果,返回true代表网络共享中。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
**示例:**
```
js
...
...
@@ -141,6 +175,21 @@ startSharing(type: SharingIfaceType, callback: AsyncCallback\<void>): void
| type |
[
SharingIfaceType
](
#sharingifacetype
)
| 是 | 共享类型,0:Wi-Fi 1:USB 2:BLUETOOTH。 |
| callback | AsyncCallback
\<
void> | 是 | 回调函数,返回开启网络共享结果。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
| 2202004 | Try to share an unavailable iface. |
| 2202005 | WiFi sharing failed. |
| 2202006 | Bluetooth sharing failed. |
| 2202009 | Network share enable forwarding error. |
| 2202011 | Cannot get network sharing configuration. |
**示例:**
```
js
...
...
@@ -174,6 +223,21 @@ startSharing(type: SharingIfaceType): Promise\<void>
| --------------------------------- | ------------------------------------- |
| Promise
\<
void> | 以Promise形式返回开启共享执行结果。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
| 2202004 | Try to share an unavailable iface. |
| 2202005 | WiFi sharing failed. |
| 2202006 | Bluetooth sharing failed. |
| 2202009 | Network share enable forwarding error. |
| 2202011 | Cannot get network sharing configuration. |
**示例:**
```
js
...
...
@@ -204,6 +268,19 @@ stopSharing(type: SharingIfaceType, callback: AsyncCallback\<void>): void
| type |
[
SharingIfaceType
](
#sharingifacetype
)
| 是 | 共享类型,0:Wi-Fi 1:USB 2:BLUETOOTH。 |
| callback | AsyncCallback
\<
void> | 是 | 回调函数,返回停止网络共享结果。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
| 2202005 | WiFi sharing failed. |
| 2202006 | Bluetooth sharing failed. |
| 2202011 | Cannot get network sharing configuration. |
**示例:**
```
js
...
...
@@ -237,6 +314,19 @@ stopSharing(type: SharingIfaceType): Promise\<void>
| --------------------------------- | ------------------------------------- |
| Promise
\<
void> | 以Promise形式返回关闭共享执行结果。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
| 2202005 | WiFi sharing failed. |
| 2202006 | Bluetooth sharing failed. |
| 2202011 | Cannot get network sharing configuration. |
**示例:**
```
js
...
...
@@ -266,6 +356,14 @@ getStatsRxBytes(callback: AsyncCallback\<number>): void
| -------- | --------------------------------------- | ---- | ---------- |
| callback | AsyncCallback
\<
number> | 是 | 回调函数,number代表数据量,单位:KB。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
**示例:**
```
js
...
...
@@ -293,6 +391,14 @@ getStatsRxBytes(): Promise\<number>
| --------------------------------- | ------------------------------------- |
| Promise
\<
number> | 以Promise形式返回共享网络接收数据量,单位:KB。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
**示例:**
```
js
...
...
@@ -321,6 +427,14 @@ getStatsTxBytes(callback: AsyncCallback\<number>): void
| -------- | --------------------------------------- | ---- | ---------- |
| callback | AsyncCallback
\<
number> | 是 | 回调函数,number代表数据量,单位:KB。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
**示例:**
```
js
...
...
@@ -348,6 +462,14 @@ getStatsTxBytes(): Promise\<number>
| --------------------------------- | ------------------------------------- |
| Promise
\<
number> | 以Promise形式返回共享网络发送数据量,单位:KB。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
**示例:**
```
js
...
...
@@ -376,6 +498,14 @@ getStatsTotalBytes(callback: AsyncCallback\<number>): void
| -------- | --------------------------------------- | ---- | ---------- |
| callback | AsyncCallback
\<
number> | 是 | 回调函数,number代表数据量,单位:KB。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
**示例:**
```
js
...
...
@@ -403,6 +533,14 @@ getStatsTotalBytes(): Promise\<number>
| --------------------------------- | ------------------------------------- |
| Promise
\<
number> | 以Promise形式返回共享网络总数据量,单位:KB。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
**示例:**
```
js
...
...
@@ -432,6 +570,16 @@ getSharingIfaces(state: SharingIfaceState, callback: AsyncCallback\<Array\<strin
| state |
[
SharingIfaceState
](
#sharingifacestate
)
| 是 | 网络共享状态。 |
| callback | AsyncCallback
\<
Array
\<
string>> | 是 | 回调函数,返回指定状态的网卡名称列表。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
**示例:**
```
js
...
...
@@ -466,6 +614,16 @@ getSharingIfaces(state: SharingIfaceState): Promise\<Array\<string>>
| --------------------------------- | ------------------------------------- |
| Promise
\<
Array
\<
string>> | 以Promise形式返回指定状态网卡名称列表。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
**示例:**
```
js
...
...
@@ -496,6 +654,16 @@ getSharingState(type: SharingIfaceType, callback: AsyncCallback\<SharingIfaceSta
| type |
[
SharingIfaceType
](
#sharingifacetype
)
| 是 | 共享类型,0:Wi-Fi 1:USB 2:BLUETOOTH。 |
| callback | AsyncCallback
\<
[
SharingIfaceState
](
#sharingifacestate
)
> | 是 | 回调函数,返回指定类型网络共享状态。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
**示例:**
```
js
...
...
@@ -524,6 +692,16 @@ getSharingState(type: SharingIfaceType): Promise\<SharingIfaceState>
| -------- | --------------------------------------- | ---- | ---------- |
| type |
[
SharingIfaceType
](
#sharingifacetype
)
| 是 | 共享类型,0:Wi-Fi 1:USB 2:BLUETOOTH。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
**返回值:**
| 类型 | 说明 |
...
...
@@ -560,6 +738,16 @@ getSharableRegexes(type: SharingIfaceType, callback: AsyncCallback\<Array\<strin
| type |
[
SharingIfaceType
](
#sharingifacetype
)
| 是 | 共享类型,0:Wi-Fi 1:USB 2:BLUETOOTH。 |
| callback | AsyncCallback
\<
Array
\<
string>> | 是 | 回调函数,返回指定类型网卡名称正则表达式列表。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
**示例:**
```
js
...
...
@@ -594,6 +782,16 @@ getSharableRegexes(type: SharingIfaceType): Promise\<Array\<string>>
| --------------------------------- | ------------------------------------- |
| Promise
\<
Array
\<
string>> | 以Promise形式返回正则表达式列表。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. |
**示例:**
```
js
...
...
@@ -624,6 +822,13 @@ on(type: 'sharingStateChange', callback: Callback\<boolean>): void
| type | string | 是 | 事件名称。 |
| callback | AsyncCallback
\<
boolean> | 是 | 回调函数,返回网络共享状态。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
**示例:**
```
js
...
...
@@ -652,6 +857,13 @@ off(type: 'sharingStateChange', callback?: Callback\<boolean>): void
| type | string | 是 | 事件名称。 |
| callback | AsyncCallback
\<
boolean> | 否 | 回调函数,返回网络共享状态。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
**示例:**
```
js
...
...
@@ -680,6 +892,13 @@ on(type: 'interfaceSharingStateChange', callback: Callback\<{ type: SharingIface
| type | string | 是 | 事件名称。 |
| callback | AsyncCallback
\<
{ type:
[
SharingIfaceType
](
#sharingifacetype
)
, iface: string, state: SharingIfaceState(#sharingifacestate) }> | 是 | 回调函数,指定网卡共享状态变化时调用。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
**示例:**
```
js
...
...
@@ -708,6 +927,13 @@ off(type: 'interfaceSharingStateChange', callback?: Callback\<{ type: SharingIfa
| type | string | 是 | 事件名称。 |
| callback | AsyncCallback
\<
{ type:
[
SharingIfaceType
](
#sharingifacetype
)
, iface: string, state: SharingIfaceState(#sharingifacestate) }> | 否 | 回调函数,注销指定网卡共享状态变化通知。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
**示例:**
```
js
...
...
@@ -736,6 +962,13 @@ on(type: 'sharingUpstreamChange', callback: Callback\<NetHandle>): void
| type | string | 是 | 事件名称。 |
| callback | AsyncCallback
\<
NetHandle> | 是 | 回调函数,上行网络变化时调用。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
**示例:**
```
js
...
...
@@ -764,6 +997,13 @@ off(type: 'sharingUpstreamChange', callback?: Callback\<NetHandle>): void
| type | string | 是 | 事件名称。 |
| callback | AsyncCallback
\<
NetHandle> | 否 | 回调函数,注销上行网络变化事件。 |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
**示例:**
```
js
...
...
zh-cn/application-dev/reference/apis/js-apis-socket.md
浏览文件 @
d82d7d39
...
...
@@ -667,6 +667,12 @@ Socket的连接信息。
| port | number | 是 | 端口号,范围0~65535。 |
| size | number | 是 | 服务器响应信息的字节长度。 |
## UDP 错误码说明
UDP 错误码映射形式为:2301000 + 内核错误码。
错误码的详细介绍参见
[
Socket错误码
](
../errorcodes/errorcode-socket.md
)
## socket.constructTCPSocketInstance
constructTCPSocketInstance
\(\)
: TCPSocket
...
...
@@ -1453,6 +1459,12 @@ TCPSocket连接的其他属性。
| reuseAddress | boolean | 否 | 是否重用地址。默认为false。 |
| socketTimeout | number | 否 | 套接字超时时间,单位毫秒(ms)。 |
## TCP 错误码说明
TCP 错误码映射形式为:2301000 + 内核错误码。
错误码的详细介绍参见
[
Socket错误码
](
../errorcodes/errorcode-socket.md
)
## socket.constructTLSSocketInstance<sup>9+</sup>
constructTLSSocketInstance(): TLSSocket
...
...
zh-cn/application-dev/reference/apis/js-apis-webSocket.md
浏览文件 @
d82d7d39
...
...
@@ -104,6 +104,11 @@ connect\(url: string, callback: AsyncCallback<boolean\>\): void
| url | string | 是 | 建立WebSocket连接的URL地址。 |
| callback | AsyncCallback
\<
boolean
\>
| 是 | 回调函数。 |
**错误码:**
| 错误码ID | 错误信息 |
|-------|---------------------------|
| 401 | Parameter error. |
**示例:**
...
...
@@ -138,6 +143,11 @@ connect\(url: string, options: WebSocketRequestOptions, callback: AsyncCallback<
| options | WebSocketRequestOptions | 是 | 参考
[
WebSocketRequestOptions
](
#websocketrequestoptions
)
。 |
| callback | AsyncCallback
\<
boolean
\>
| 是 | 回调函数。 |
**错误码:**
| 错误码ID | 错误信息 |
|-------|---------------------------|
| 401 | Parameter error. |
**示例:**
...
...
@@ -182,6 +192,12 @@ connect\(url: string, options?: WebSocketRequestOptions\): Promise<boolean\>
| :----------------- | :-------------------------------- |
| Promise
\<
boolean
\>
| 以Promise形式返回建立连接的结果。 |
**错误码:**
| 错误码ID | 错误信息 |
|-------|---------------------------|
| 401 | Parameter error. |
**示例:**
```
js
...
...
@@ -213,6 +229,12 @@ send\(data: string | ArrayBuffer, callback: AsyncCallback<boolean\>\): void
| data | string
\|
ArrayBuffer
<sup>
8+
</sup>
| 是 | 发送的数据。 |
| callback | AsyncCallback
\<
boolean
\>
| 是 | 回调函数。 |
**错误码:**
| 错误码ID | 错误信息 |
|-------|---------------------------|
| 401 | Parameter error. |
**示例:**
```
js
...
...
@@ -252,6 +274,12 @@ send\(data: string | ArrayBuffer\): Promise<boolean\>
| :----------------- | :-------------------------------- |
| Promise
\<
boolean
\>
| 以Promise形式返回发送数据的结果。 |
**错误码:**
| 错误码ID | 错误信息 |
|--------|---------------------------|
| 401 | Parameter error. |
**示例:**
```
js
...
...
@@ -284,6 +312,12 @@ close\(callback: AsyncCallback<boolean\>\): void
| -------- | ------------------------ | ---- | ---------- |
| callback | AsyncCallback
\<
boolean
\>
| 是 | 回调函数。 |
**错误码:**
| 错误码ID | 错误信息 |
|-------|---------------------------|
| 401 | Parameter error. |
**示例:**
```
js
...
...
@@ -316,6 +350,12 @@ close\(options: WebSocketCloseOptions, callback: AsyncCallback<boolean\>\): void
| options | WebSocketCloseOptions | 是 | 参考
[
WebSocketCloseOptions
](
#websocketcloseoptions
)
。 |
| callback | AsyncCallback
\<
boolean
\>
| 是 | 回调函数。 |
**错误码:**
| 错误码ID | 错误信息 |
|--------|---------------------------|
| 401 | Parameter error. |
**示例:**
```
js
...
...
@@ -356,6 +396,12 @@ close\(options?: WebSocketCloseOptions\): Promise<boolean\>
| :----------------- | :-------------------------------- |
| Promise
\<
boolean
\>
| 以Promise形式返回关闭连接的结果。 |
**错误码:**
| 错误码ID | 错误信息 |
|--------|---------------------------|
| 401 | Parameter error. |
**示例:**
```
js
...
...
@@ -388,6 +434,11 @@ on\(type: 'open', callback: AsyncCallback<Object\>\): void
| type | string | 是 | 'open':WebSocket的打开事件。 |
| callback | AsyncCallback
\<
Object
\>
| 是 | 回调函数。 |
**错误码:**
| 错误码ID | 错误信息 |
|-------|---------------------------|
| 401 | Parameter error. |
**示例:**
...
...
@@ -417,6 +468,12 @@ off\(type: 'open', callback?: AsyncCallback<Object\>\): void
| type | string | 是 | 'open':WebSocket的打开事件。 |
| callback | AsyncCallback
\<
Object
\>
| 否 | 回调函数。 |
**错误码:**
| 错误码ID | 错误信息 |
|-------|---------------------------|
| 401 | Parameter error. |
**示例:**
```
js
...
...
@@ -448,6 +505,11 @@ on\(type: 'message', callback: AsyncCallback<string | ArrayBuffer\>\): void
| type | string | 是 | 'message':WebSocket的接收到服务器消息事件。 |
| callback | AsyncCallback
\<
string
\|
ArrayBuffer
<sup>
8+
</sup>
\>
| 是 | 回调函数。 |
**错误码:**
| 错误码ID | 错误信息 |
|--------|---------------------------|
| 401 | Parameter error. |
**示例:**
...
...
@@ -478,6 +540,12 @@ off\(type: 'message', callback?: AsyncCallback<string | ArrayBuffer\>\): void
| type | string | 是 | 'message':WebSocket的接收到服务器消息事件。 |
| callback | AsyncCallback
\<
string
\|
ArrayBuffer
<sup>
8+
</sup>
\>
| 否 | 回调函数。 |
**错误码:**
| 错误码ID | 错误信息 |
|-------|---------------------------|
| 401 | Parameter error. |
**示例:**
```
js
...
...
@@ -529,6 +597,11 @@ off\(type: 'close', callback?: AsyncCallback<\{ code: number, reason: string \}\
| type | string | 是 | 'close':WebSocket的关闭事件。 |
| callback | AsyncCallback
<
{
code:
number
,
reason:
string
}
>
| 否 | 回调函数。 |
**错误码:**
| 错误码ID | 错误信息 |
|-------|---------------------------|
| 401 | Parameter error. |
**示例:**
...
...
@@ -553,6 +626,11 @@ on\(type: 'error', callback: ErrorCallback\): void
| type | string | 是 | 'error':WebSocket的Error事件。 |
| callback | ErrorCallback | 是 | 回调函数。 |
**错误码:**
| 错误码ID | 错误信息 |
|-------|---------------------------|
| 401 | Parameter error. |
**示例:**
...
...
@@ -582,6 +660,12 @@ off\(type: 'error', callback?: ErrorCallback\): void
| type | string | 是 | 'error':WebSocket的Error事件。 |
| callback | ErrorCallback | 否 | 回调函数。 |
**错误码:**
| 错误码ID | 错误信息 |
|--------|---------------------------|
| 401 | Parameter error. |
**示例:**
```
js
...
...
zh-cn/application-dev/reference/errorcodes/Readme-CN.md
浏览文件 @
d82d7d39
...
...
@@ -47,6 +47,8 @@
-
[
文件管理子系统错误码
](
errorcode-filemanagement.md
)
-
网络管理
-
[
上传下载错误码
](
errorcode-request.md
)
-
[
HTTP错误码
](
errorcode-http.md
)
-
[
Socket错误码
](
errorcode-socket.md
)
-
通信与连接
-
[
NFC错误码
](
errorcode-nfc.md
)
-
[
RPC错误码
](
errorcode-rpc.md
)
...
...
zh-cn/application-dev/reference/errorcodes/errorcode-http.md
0 → 100644
浏览文件 @
d82d7d39
# HTTP错误码
## 2300001 不支持的协议
**错误信息**
Unsupported protocol.
**错误描述**
协议版本服务器不支持。
**可能原因**
传入的协议版本,服务器不支持。
**处理步骤**
请检查传入的协议版本是否合理,排查服务器实现。
## 2300003 URL格式错误
**错误信息**
URL using bad/illegal format or missing URL.
**错误描述**
URL格式错误。
**可能原因**
可能传入的url格式不正确。
**处理步骤**
检查传入的url格式是否正确。
## 2300005 代理服务器域名解析失败
**错误信息**
Couldn't resolve proxy name.
**错误描述**
代理服务器的域名无法解析。
**可能原因**
服务器的URL不正确
**处理步骤**
排查代理服务器的URL是否正确。
## 2300006 域名解析失败
**错误信息**
Couldn't resolve host name.
**错误描述**
服务器的域名无法解析。
**可能原因**
传入的服务器的URL不正确。
**处理步骤**
请检查入的服务器的URL是否合理。
## 2300007 无法连接到服务器
**错误信息**
Couldn't connect to server.
**错误描述**
服务器无法连接。
**可能原因**
可能传入的url格式不正确。
**处理步骤**
检查传入的url格式是否正确。
## 2300008 服务器返回非法数据
**错误信息**
Weird server reply.
**错误描述**
服务器返回非法数据。
**可能原因**
服务器出错,返回了非HTTP格式的数据。
**处理步骤**
排查服务器实现。
## 2300009 拒绝对远程资源的访问
**错误信息**
Access denied to remote resource.
**错误描述**
拒绝对远程资源的访问。
**可能原因**
指定的内容被服务器拒绝访问。
**处理步骤**
排查请求内容。
## 2300016 HTT2帧层错误
**错误信息**
Error in the HTTP2 framing layer.
**错误描述**
HTTP2层级的错误。
**可能原因**
服务器不支持HTTP2。
**处理步骤**
抓包分析、排查服务器是否支持HTTP2。
## 2300018 服务器返回数据不完整
**错误信息**
Transferred a partial file.
**错误描述**
服务器返回的数据不完整。
**可能原因**
可能与服务器实现有关
**处理步骤**
排查服务器实现。
## 2300023 向磁盘/应用程序写入接收数据失败
**错误信息**
Failed writing received data to disk/application.
**错误描述**
向磁盘/应用程序写入接收数据失败。
**可能原因**
应用没有写文件权限。
**处理步骤**
排查应用权限。
## 2300025 上传失败
**错误信息**
Upload failed.
**错误描述**
上传失败。
**可能原因**
文件过大或者网络问题。对于FTP,服务器通常会拒绝STOR命令。错误缓冲区通常包含服务器的解释。
**处理步骤**
排查文件大小及网络状况。
## 2300026 从文件/应用程序中打开/读取本地数据失败
**错误信息**
Failed to open/read local data from file/application.
**错误描述**
从文件/应用程序中打开/读取本地数据失败。
**可能原因**
应用没有读文件权限
**处理步骤**
排查应用权限。
## 2300027 内存不足
**错误信息**
Out of memory.
**错误描述**
内存不足。
**可能原因**
内存不足。
**处理步骤**
排查系统内存。
## 2300028 操作超时
**错误信息**
Timeout was reached.
**错误描述**
操作超时。
**可能原因**
TCP连接超时或读写超时。
**处理步骤**
排查网络问题。
## 2300047 重定向次数达到最大值
**错误信息**
Number of redirects hit maximum amount.
**错误描述**
重定向次数达到最大值。
**可能原因**
重定向次数过多
**处理步骤**
排查服务器实现。
## 2300052 服务器没有返回内容
**错误信息**
Server returned nothing (no headers, no data).
**错误描述**
服务器没有返回内容。
**可能原因**
可能与服务器实现有关。
**处理步骤**
排查服务器实现。
## 2300055 发送网络数据失败
**错误信息**
Failed sending data to the peer.
**错误描述**
无法往对端发送数据,发送网络数据失败。
**可能原因**
网络问题。
**处理步骤**
排查网络。
## 2300056 接收网络数据失败
**错误信息**
Failure when receiving data from the peer.
**错误描述**
无法往从对端收到数据,接收网络数据失败。
**可能原因**
网络问题
**处理步骤**
排查网络问题。
## 2300058 本地SSL证书错误
**错误信息**
Problem with the local SSL certificate.
**错误描述**
本地SSL证书错误。
**可能原因**
SSL证书格式有错误。
**处理步骤**
检查SSL证书格式。
## 2300059 无法使用指定的密码
**错误信息**
Couldn't use specified SSL cipher.
**错误描述**
无法使用指定的密码。
**可能原因**
client和sever协商的加密算法系统不支持。
**处理步骤**
抓包分析协商的算法。
## 2300060 远程服务器SSL证书或SSH秘钥不正确
**错误信息**
SSL peer certificate or SSH remote key was not OK.
**错误描述**
远程服务器SSL证书或SSH秘钥不正确。
**可能原因**
无法校验服务器身份,有可能是证书过期了
**处理步骤**
检查证书有效性。
## 2300061 无法识别或错误的HTTP编码格式
**错误信息**
Unrecognized or bad HTTP Content or Transfer-Encoding.
**错误描述**
无法识别或错误的HTTP编码格式。
**可能原因**
HTTP编码格式不正确。
**处理步骤**
排查服务器实现,目前仅支持gzip编码。
## 2300063 超出最大文件大小
**错误信息**
Maximum file size exceeded.
**错误描述**
超出最大文件大小。
**可能原因**
下载的文件过大。
**处理步骤**
排查服务器实现。
## 2300070 服务器磁盘空间不足
**错误信息**
Remote disk full or allocation exceeded.
**错误描述**
服务器磁盘空间不足。
**可能原因**
服务器磁盘已满
**处理步骤**
检查服务器磁盘空间。
## 2300073 服务器返回文件已存在
**错误信息**
Remote file already exists.
**错误描述**
服务器返回文件已存在。
**可能原因**
上传文件的时候,服务器返回文件已经存在。
**处理步骤**
排查服务器。
## 2300077 SSL CA证书不存在或没有访问权限
**错误信息**
Problem with the SSL CA cert (path? access rights?).
**错误描述**
SSL CA证书不存在或没有访问权限。
**可能原因**
证书不存在或者没有访问权限。
**处理步骤**
检查证书是否存在或者有没有访问权限。
## 2300078 URL请求的文件不存在
**错误信息**
Remote file not found.
**错误描述**
URL请求的文件不存在。
**可能原因**
URL请求的文件不存在
**处理步骤**
检查URL请求的文件是否存在。
## 2300094 身份校验失败
**错误信息**
An authentication function returned an error.
**错误描述**
身份校验失败。
**可能原因**
传入的校验身份的字段与服务器不匹配。
**处理步骤**
排查传入的校验身份的字段是否与服务器匹配。
## 2300999 未知错误
**错误信息**
Unknown Other Error.
**错误描述**
未知错误。
**可能原因**
未知错误。
**处理步骤**
未知错误。
zh-cn/application-dev/reference/errorcodes/errorcode-socket.md
0 → 100644
浏览文件 @
d82d7d39
# TCP/UDP 错误码
## 2301001 操作不允许
**错误信息**
Operation not permitted.
**错误描述**
操作不允许。
**可能原因**
非法操作。
**处理步骤**
检查操作步骤。
## 2301002 文件不存在
**错误信息**
No such file or directory.
**错误描述**
文件不存在。
**可能原因**
文件不存在。
**处理步骤**
检查文件名或文件路径。
## 2301003 进程不存在
**错误信息**
No such process.
**错误描述**
进程不存在。
**可能原因**
进程不存在
**处理步骤**
排查进程信息。
## 2300004 Interrupted system call
**错误信息**
Couldn't resolve host name.
**错误描述**
系统调用中断。
**可能原因**
系统调用中断。
**处理步骤**
排查系统调用。
**TCP/UDP 错误码说明:**
> 其余错误码映射形式为:2301000 + 内核错误码,关键信息请参考内核错误码。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录