diff --git a/lib/errors.js b/lib/errors.js index 033e90985..c1cf4ae7e 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -261,7 +261,7 @@ class BadTimestamp { } } class BadGeocoordinates { - constructor(payload) { + constructor(payload, deviceData) { this.name = 'BAD_GEOCOORDINATES'; this.message = 'Invalid rfc7946 coordinates [' + payload + ']'; this.code = 400; diff --git a/lib/services/devices/devices-NGSI-v2.js b/lib/services/devices/devices-NGSI-v2.js index 9efb65707..77ee7431f 100644 --- a/lib/services/devices/devices-NGSI-v2.js +++ b/lib/services/devices/devices-NGSI-v2.js @@ -210,7 +210,7 @@ function updateEntityNgsi2(deviceData, updatedDevice, callback) { // Format any GeoJSON attrs properly options.json[att] = NGSIv2.formatGeoAttrs(options.json[att]); } catch (error) { - return callback(new errors.BadGeocoordinates(JSON.stringify(options.json))); + return callback(new errors.BadGeocoordinates(JSON.stringify(options.json), deviceData)); } } diff --git a/lib/services/ngsi/entities-NGSI-LD.js b/lib/services/ngsi/entities-NGSI-LD.js index 81046aee3..be8512905 100644 --- a/lib/services/ngsi/entities-NGSI-LD.js +++ b/lib/services/ngsi/entities-NGSI-LD.js @@ -1052,7 +1052,7 @@ function sendUpdateValueNgsiLD(entityName, attributes, typeInformation, token, c options.json = [formatAsNGSILD(options.json)]; } } catch (error) { - return callback(new errors.BadGeocoordinates(JSON.stringify(payload))); + return callback(new errors.BadGeocoordinates(JSON.stringify(payload), typeInformation)); } if (typeInformation.active) {