@cpzxrobot/sdk 1.3.51 → 1.3.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/device_filter.ts CHANGED
@@ -31,7 +31,7 @@ export abstract class DeviceFilter<T extends { id: number }> {
31
31
  }
32
32
 
33
33
  add(device: any) {
34
- this.context.ready.then(axios=>{
34
+ this.context.ready.then(axios => {
35
35
  return axios.post("/api/v2/device/add", device)
36
36
  })
37
37
  }
@@ -208,7 +208,9 @@ export abstract class DeviceFilter<T extends { id: number }> {
208
208
  if (args.type == "raw") {
209
209
  return res;
210
210
  } else {
211
- if (res.data.Error) {
211
+ if (res.data) {
212
+ throw "device_list error("+JSON.stringify(res)+")";
213
+ } else if (res.data.Error) {
212
214
  throw res.data.Error;
213
215
  }
214
216
  // this.devices.push(res.data);
@@ -189,7 +189,10 @@ class DeviceFilter {
189
189
  return res;
190
190
  }
191
191
  else {
192
- if (res.data.Error) {
192
+ if (res.data) {
193
+ throw "device_list error(" + JSON.stringify(res) + ")";
194
+ }
195
+ else if (res.data.Error) {
193
196
  throw res.data.Error;
194
197
  }
195
198
  // this.devices.push(res.data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.3.51",
3
+ "version": "1.3.52",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {