From: Pawel Wasowski Date: Thu, 31 Aug 2017 12:16:00 +0000 (+0200) Subject: [Sensor] Apply fix of errorWrapper to uncalibrated sensor types X-Git-Tag: submit/tizen/20170906.125601~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b6b050c30eddebfd4de5d6a4ac62471b41e32e8f;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [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 --- 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