提交 0614e189 编写于 作者: @ @shi-xiaoxiao-iris

[分布式硬件]api示例添加异常处理

Signed-off-by: N@shi-xiaoxiao-iris <shixiaoxiao2@huawei.com>
上级 b4b671fc
......@@ -347,6 +347,7 @@ getLocalDeviceInfo(callback:AsyncCallback&lt;DeviceInfo&gt;): void
this.dmInstance.getLocalDeviceInfo((err, data) => {
if (err) {
console.error("getLocalDeviceInfo errCode:" + err.code + ",errMessage:" + err.message);
return;
}
console.log('get local device info: ' + JSON.stringify(data));
});
......@@ -527,9 +528,9 @@ unPublishDeviceDiscovery(publishId: number): void
```js
// 入参需要和publishDeviceDiscovery接口传入的publishId配对使用
try {
dmInstance.publishDeviceDiscovery(publishInfo); // 当有发布结果时,通过回调通知给应用程序
dmInstance.unPublishDeviceDiscovery(publishId);
} catch (err) {
console.error("publishDeviceDiscovery errCode:" + err.code + ",errMessage:" + err.message);
console.error("unPublishDeviceDiscovery errCode:" + err.code + ",errMessage:" + err.message);
}
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册