[Sensor] Apply fix of errorWrapper to uncalibrated sensor types 60/147760/1
authorPawel Wasowski <p.wasowski2@partner.samsung.com>
Thu, 31 Aug 2017 12:16:00 +0000 (14:16 +0200)
committerPawel Wasowski <p.wasowski2@partner.samsung.com>
Tue, 5 Sep 2017 12:05:14 +0000 (14:05 +0200)
This is an application of the fix introduced to other sensors in the
commit fd29eb43608a2107fd6a31938adb54c37fd153d5

[Verification] TCT passrate: 100 %

Change-Id: Ifa80efe03478ce2a73b090e73a769b1b246dd697
Signed-off-by: Pawel Wasowski <p.wasowski2@partner.samsung.com>
src/sensor/sensor_api.js

index 1342f84357ab1ce571b3f73f07365a7de71d0425..609780c83a7dc1dc9a0209c120a88013cdca55c9 100755 (executable)
@@ -630,15 +630,8 @@ MagneticUncalibratedSensor.prototype.getMagneticUncalibratedSensorData = functio
         }
     ]);
 
-    function errorWrapper(err) {
-        if (err.name === "UnknownError") {
-            args.errorCallback(new WebAPIException(WebAPIException.ABORT_ERR, err.message));
-        } else {
-            args.errorCallback(err);
-        }
-    }
-    _sensorListeners[this.sensorType].getData(args.successCallback, errorWrapper);
-}
+    _sensorListeners[this.sensorType].getData(args.successCallback, errorWrapper.bind(args));
+};
 
 //// GyroscopeUncalibratedSensor
 var GyroscopeUncalibratedSensor = function(data) {
@@ -663,15 +656,8 @@ GyroscopeUncalibratedSensor.prototype.getGyroscopeUncalibratedSensorData = funct
         }
     ]);
 
-    function errorWrapper(err) {
-        if (err.name === "UnknownError") {
-            args.errorCallback(new WebAPIException(WebAPIException.ABORT_ERR, err.message));
-        } else {
-            args.errorCallback(err);
-        }
-    }
-    _sensorListeners[this.sensorType].getData(args.successCallback, errorWrapper);
-}
+    _sensorListeners[this.sensorType].getData(args.successCallback, errorWrapper.bind(args));
+};
 
 ////////////////////// Sensor Data classes/////////////////////////////////////////////////////
 ////Base SensorData class