• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# USB Manager Changelog
2
3## cl.usb_manager.1 Error Information Return Method Change
4
5The USB Manager APIs use service logic return values to indicate error information, which does not comply with the API error code specifications of OpenHarmony. Beginning from API version 9, error information is returned by throwing exceptions.
6
7**Change Impact**
8
9The application developed based on earlier versions needs to adapt the method for returning API error information. Otherwise, the original service logic will be affected.
10
11**Key API/Component Changes**
12
13Changed the USB module name from **@ohos.usb.d.ts** to **@ohos.usbV9.d.ts**, and added error code processing for all APIs in the module.
14
15**Adaptation Guide**
16
17Take the **getDevices** API as an example. The sample code is as follows:
18
19```ts
20import usbV9 from '@ohos.usbV9'
21
22try {
23usbV9.getDevices(); // If an improper parameter is passed to this API, an exception will be thrown.
24} catch (err) {
25console.error("getDevices errCode:" + err.code + ",errMessage:" + err.message);
26}
27```
28