diff --git a/api/@ohos.net.http.d.ts b/api/@ohos.net.http.d.ts index 72f99a8ca..da8ec2d5c 100644 --- a/api/@ohos.net.http.d.ts +++ b/api/@ohos.net.http.d.ts @@ -99,6 +99,37 @@ declare namespace http { * @param options Optional parameters {@link HttpRequestOptions}. * @param callback Returns {@link HttpResponse}. * @permission ohos.permission.INTERNET + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 2300001 - Unsupported protocol. + * @throws {BusinessError} 2300003 - URL using bad/illegal format or missing URL. + * @throws {BusinessError} 2300005 - Couldn't resolve proxy name. + * @throws {BusinessError} 2300006 - Couldn't resolve host name. + * @throws {BusinessError} 2300007 - Couldn't connect to server. + * @throws {BusinessError} 2300008 - Weird server reply. + * @throws {BusinessError} 2300009 - Access denied to remote resource. + * @throws {BusinessError} 2300016 - Error in the HTTP2 framing layer. + * @throws {BusinessError} 2300018 - Transferred a partial file. + * @throws {BusinessError} 2300023 - Failed writing received data to disk/application. + * @throws {BusinessError} 2300025 - Upload failed. + * @throws {BusinessError} 2300026 - Failed to open/read local data from file/application. + * @throws {BusinessError} 2300027 - Out of memory. + * @throws {BusinessError} 2300028 - Timeout was reached. + * @throws {BusinessError} 2300047 - Number of redirects hit maximum amount. + * @throws {BusinessError} 2300052 - Server returned nothing (no headers, no data). + * @throws {BusinessError} 2300055 - Failed sending data to the peer. + * @throws {BusinessError} 2300056 - Failure when receiving data from the peer. + * @throws {BusinessError} 2300058 - Problem with the local SSL certificate. + * @throws {BusinessError} 2300059 - Couldn't use specified SSL cipher. + * @throws {BusinessError} 2300060 - SSL peer certificate or SSH remote key was not OK. + * @throws {BusinessError} 2300061 - Unrecognized or bad HTTP Content or Transfer-Encoding. + * @throws {BusinessError} 2300063 - Maximum file size exceeded. + * @throws {BusinessError} 2300070 - Disk full or allocation exceeded. + * @throws {BusinessError} 2300073 - Remote file already exists. + * @throws {BusinessError} 2300077 - Problem with the SSL CA cert (path? access rights?). + * @throws {BusinessError} 2300078 - Remote file not found. + * @throws {BusinessError} 2300094 - An authentication function returned an error. + * @throws {BusinessError} 2300999 - Unknown Other Error. */ request(url: string, callback: AsyncCallback): void; request(url: string, options: HttpRequestOptions, callback: AsyncCallback): void; diff --git a/api/@ohos.net.socket.d.ts b/api/@ohos.net.socket.d.ts index 4e58a095c..16c7a5126 100644 --- a/api/@ohos.net.socket.d.ts +++ b/api/@ohos.net.socket.d.ts @@ -135,6 +135,8 @@ declare namespace socket { * * @param address Destination address. {@link NetAddress} * @permission ohos.permission.INTERNET + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 201 - Permission denied. */ bind(address: NetAddress, callback: AsyncCallback): void; bind(address: NetAddress): Promise; @@ -144,6 +146,8 @@ declare namespace socket { * * @param options Optional parameters {@link UDPSendOptions}. * @permission ohos.permission.INTERNET + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 201 - Permission denied. */ send(options: UDPSendOptions, callback: AsyncCallback): void; send(options: UDPSendOptions): Promise; @@ -151,6 +155,7 @@ declare namespace socket { /** * Closes a UDPSocket connection. * @permission ohos.permission.INTERNET + * @throws {BusinessError} 201 - Permission denied. */ close(callback: AsyncCallback): void; close(): Promise; @@ -160,6 +165,7 @@ declare namespace socket { * * @param callback Callback used to return the result. {@link SocketStateBase}. * @permission ohos.permission.INTERNET + * @throws {BusinessError} 201 - Permission denied. */ getState(callback: AsyncCallback): void; getState(): Promise; @@ -169,6 +175,8 @@ declare namespace socket { * * @param options Optional parameters {@link UDPExtraOptions}. * @permission ohos.permission.INTERNET + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 201 - Permission denied. */ setExtraOptions(options: UDPExtraOptions, callback: AsyncCallback): void; setExtraOptions(options: UDPExtraOptions): Promise; @@ -256,6 +264,8 @@ declare namespace socket { * * @param address Destination address. {@link NetAddress} * @permission ohos.permission.INTERNET + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 201 - Permission denied. */ bind(address: NetAddress, callback: AsyncCallback): void; bind(address: NetAddress): Promise; @@ -265,6 +275,8 @@ declare namespace socket { * * @param options Optional parameters {@link TCPConnectOptions}. * @permission ohos.permission.INTERNET + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 201 - Permission denied. */ connect(options: TCPConnectOptions, callback: AsyncCallback): void; connect(options: TCPConnectOptions): Promise; @@ -274,6 +286,8 @@ declare namespace socket { * * @param options Optional parameters {@link TCPSendOptions}. * @permission ohos.permission.INTERNET + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 201 - Permission denied. */ send(options: TCPSendOptions, callback: AsyncCallback): void; send(options: TCPSendOptions): Promise; @@ -281,6 +295,7 @@ declare namespace socket { /** * Closes a TCPSocket connection. * @permission ohos.permission.INTERNET + * @throws {BusinessError} 201 - Permission denied. */ close(callback: AsyncCallback): void; close(): Promise; @@ -290,6 +305,7 @@ declare namespace socket { * * @param callback Callback used to return the result. {@link NetAddress} * @permission ohos.permission.INTERNET + * @throws {BusinessError} 201 - Permission denied. */ getRemoteAddress(callback: AsyncCallback): void; getRemoteAddress(): Promise; @@ -299,6 +315,7 @@ declare namespace socket { * * @param callback Callback used to return the result. {@link SocketStateBase} * @permission ohos.permission.INTERNET + * @throws {BusinessError} 201 - Permission denied. */ getState(callback: AsyncCallback): void; getState(): Promise; @@ -308,6 +325,8 @@ declare namespace socket { * * @param options Optional parameters {@link TCPExtraOptions}. * @permission ohos.permission.INTERNET + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 201 - Permission denied. */ setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback): void; setExtraOptions(options: TCPExtraOptions): Promise; diff --git a/api/@ohos.net.webSocket.d.ts b/api/@ohos.net.webSocket.d.ts index e71c31918..d06587146 100644 --- a/api/@ohos.net.webSocket.d.ts +++ b/api/@ohos.net.webSocket.d.ts @@ -53,6 +53,8 @@ declare namespace webSocket { * @param options Optional parameters {@link WebSocketRequestOptions}. * @param callback Returns callback used to return the execution result. * @permission ohos.permission.INTERNET + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 201 - Permission denied. */ connect(url: string, callback: AsyncCallback): void; connect(url: string, options: WebSocketRequestOptions, callback: AsyncCallback): void; @@ -64,6 +66,8 @@ declare namespace webSocket { * @param data Data to send. It can be a string(API 6) or an ArrayBuffer(API 8). * @param callback Returns callback used to return the execution result. * @permission ohos.permission.INTERNET + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 201 - Permission denied. */ send(data: string | ArrayBuffer, callback: AsyncCallback): void; send(data: string | ArrayBuffer): Promise; @@ -74,6 +78,8 @@ declare namespace webSocket { * @param options Optional parameters {@link WebSocketCloseOptions}. * @param callback Returns callback used to return the execution result. * @permission ohos.permission.INTERNET + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 201 - Permission denied. */ close(callback: AsyncCallback): void; close(options: WebSocketCloseOptions, callback: AsyncCallback): void;