Skip to content

Commit

Permalink
add typeInformation to TypeNotFound error
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvaroVega committed Feb 21, 2024
1 parent 93cc2d4 commit ef68669
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions lib/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ class UnsupportedContentType {
}
}
class TypeNotFound {
constructor(id, type) {
constructor(id, type, typeInformation) {
this.name = 'TYPE_NOT_FOUND';
this.message = 'Type : ' + type + ' not found for device with id: ' + id;
this.message =
'Type : ' + type + ' not found for device with id: ' + id + ' with: ' + JSON.stringify(typeInformation);
this.code = 500;
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/services/ngsi/entities-NGSI-LD.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ function sendQueryValueNgsiLD(entityName, attributes, typeInformation, token, ca
options.method = 'GET';

if (!typeInformation || !typeInformation.type) {
callback(new errors.TypeNotFound(null, entityName));
callback(new errors.TypeNotFound(null, entityName, typeInformation));
return;
}

Expand Down Expand Up @@ -545,7 +545,7 @@ function sendUpdateValueNgsiLD(entityName, attributes, typeInformation, token, c
}

if (!typeInformation || !typeInformation.type) {
callback(new errors.TypeNotFound(null, entityName));
callback(new errors.TypeNotFound(null, entityName, typeInformation));
return;
}
const idTypeSSSList = pluginUtils.getIdTypeServSubServiceFromDevice(typeInformation);
Expand Down
4 changes: 2 additions & 2 deletions lib/services/ngsi/entities-NGSI-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ function sendQueryValueNgsi2(entityName, attributes, typeInformation, token, cal
options.method = 'GET';

if (!typeInformation || !typeInformation.type) {
callback(new errors.TypeNotFound(null, entityName));
callback(new errors.TypeNotFound(null, entityName, typeInformation));
return;
}

Expand Down Expand Up @@ -295,7 +295,7 @@ function sendUpdateValueNgsi2(entityName, measures, typeInformation, token, call

//Check mandatory information: type
if (!typeInformation || !typeInformation.type) {
callback(new errors.TypeNotFound(null, entityName));
callback(new errors.TypeNotFound(null, entityName, typeInformation));
return;
}
//Rename all measures with matches with id and type to measure_id and measure_type
Expand Down

0 comments on commit ef68669

Please sign in to comment.