[Device] fixed handle error 17/70417/2 accepted/tizen/common/20160519.191558 submit/tizen/20160519.080635
authorLukasz Bardeli <l.bardeli@samsung.com>
Thu, 19 May 2016 07:29:38 +0000 (09:29 +0200)
committerLukasz Bardeli <l.bardeli@samsung.com>
Thu, 19 May 2016 07:29:38 +0000 (09:29 +0200)
Change-Id: I1d357e2a36d37f331588f2d082734fa98eb79508
Signed-off-by: Lukasz Bardeli <l.bardeli@samsung.com>
src/lib/plugins/cordova-plugin-device/tizen/Device.js

index 34da27c..ae1b591 100755 (executable)
@@ -21,14 +21,39 @@ cordova.define(plugin_name, function(require, exports, module) {
 // TODO: remove -> end
 
 function DeviceInfo() {
-  this.cordovaVersion = require('cordova/platform').cordovaVersion;
-  this.model = tizen.systeminfo.getCapability('http://tizen.org/system/model_name');
-  this.platform = tizen.systeminfo.getCapability('http://tizen.org/system/platform.name');
-  this.uuid = tizen.systeminfo.getCapability('http://tizen.org/system/tizenid');
-  this.version = tizen.systeminfo.getCapability('http://tizen.org/feature/platform.version');
-  this.manufacturer = tizen.systeminfo.getCapability('http://tizen.org/system/manufacturer');
-  this.isVirtual = -1 !== this.model.toLowerCase().indexOf('emulator');
-  this.serial = this.uuid;
+  try {
+    this.model = tizen.systeminfo.getCapability('http://tizen.org/system/model_name');
+    this.isVirtual = -1 !== this.model.toLowerCase().indexOf('emulator');
+  } catch (e) {
+    console.log(e);
+    this.model = undefined;
+    this.isVirtual = undefined;
+  }
+  try {
+    this.platform = tizen.systeminfo.getCapability('http://tizen.org/system/platform.name');
+  } catch (e) {
+    console.log(e);
+    this.platform = undefined;
+  }
+  try {
+    this.uuid = tizen.systeminfo.getCapability('http://tizen.org/system/tizenid');
+    this.serial = this.uuid;
+  } catch (e) {
+    console.log(e);
+    this.uuid = undefined;
+    this.serial = undefined;
+  }
+  try {
+    this.version = tizen.systeminfo.getCapability('http://tizen.org/feature/platform.version');
+  } catch (e) {
+    console.log(e);
+    this.version = undefined;
+  }
+  try {
+    this.manufacturer = tizen.systeminfo.getCapability('http://tizen.org/system/manufacturer');
+  } catch (e) {
+    console.log(e);
+    this.manufacturer = undefined;
 }
 
 var di;