From b6b050c30eddebfd4de5d6a4ac62471b41e32e8f Mon Sep 17 00:00:00 2001
From: Pawel Wasowski
Date: Thu, 31 Aug 2017 14:16:00 +0200
Subject: [PATCH] [Sensor] Apply fix of errorWrapper to uncalibrated sensor
types
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
---
src/sensor/sensor_api.js | 22 ++++------------------
1 file changed, 4 insertions(+), 18 deletions(-)
diff --git a/src/sensor/sensor_api.js b/src/sensor/sensor_api.js
index 1342f843..609780c8 100755
--- a/src/sensor/sensor_api.js
+++ b/src/sensor/sensor_api.js
@@ -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
--
2.34.1