telefonicaid / iotagent-node-lib

Module to enable IoT Agent developers to build custom agents for their devices that can easily connect to NGSI Context Brokers
https://iotagent-node-lib.rtfd.io/
GNU Affero General Public License v3.0
60 stars 85 forks source link

add device/group information to error log about some errors #1582

Closed AlvaroVega closed 7 months ago

AlvaroVega commented 7 months ago
AlvaroVega commented 7 months ago

related: https://github.com/telefonicaid/iotagent-node-lib/pull/1536

AlvaroVega commented 7 months ago

curl -i -X POST 'http://localhost:7897/iot/json?i=dispNew&k=izc9cokegoy7kyfgdd6etipt6&t=null' -d '{ "c": 3, "d": 4}' -H 'content-type: application/json' HTTP/1.1 404 Not Found

{"name":"DEVICE_GROUP_NOT_FOUND","message":"Couldn\t find device group for fields: [\"resource\",\"apikey\"] and values: {\"resource\":\"/iot/json\",\"apikey\":\"izc9cokegoy7kyfgdd6etipt6\"}"}

and

curl -i -X POST 'http://localhost:7897/iot/json?i=dispNew&k=zrvj173zhvzb12t233z48vg96&t=null' -d '{ "c": 3, "d": 4}' -H 'content-type: application/json' HTTP/1.1 400 Bad Request

{"name":"BAD_TIMESTAMP","message":"Invalid ISO8601 timestamp [null] in [thing:dispNew] with: {\"lazy\":[],\"commands\":[],\"staticAttributes\":[],\"_id\":\"65d6f363f2a300f0ee1ab67b\",\"creationDate\":\"2024-02-22T07:10:27.765Z\",\"id\":\"dispNew\",\"type\":\"thing\",\"name\":\"thing:dispNew\",\"service\":\"smartcity\",\"subservice\":\"/\",\"apikey\":\"zrvj173zhvzb12t233z48vg96\",\"protocol\":\"IoTA-JSON\",\"__v\":0,\"active\":[],\"subscriptions\":[],\"timestamp\":true}"}