Skip to content

Commit

Permalink
add BadGeocoordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvaroVega committed Feb 22, 2024
1 parent af0ae4e commit 5d6f54d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ class BadTimestamp {
}
}
class BadGeocoordinates {
constructor(payload) {
constructor(payload, deviceData) {

Check failure on line 264 in lib/errors.js

View workflow job for this annotation

GitHub Actions / Lint JavaScript

'deviceData' is defined but never used
this.name = 'BAD_GEOCOORDINATES';
this.message = 'Invalid rfc7946 coordinates [' + payload + ']';
this.code = 400;
Expand Down
2 changes: 1 addition & 1 deletion lib/services/devices/devices-NGSI-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/services/ngsi/entities-NGSI-LD.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 5d6f54d

Please sign in to comment.