Skip to content

Commit

Permalink
Catch possible error
Browse files Browse the repository at this point in the history
  • Loading branch information
Jey-Cee committed Oct 1, 2024
1 parent adefcf9 commit b4dd8e0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,8 @@ function setNewState(state, serviceID, data, cb) {

let newStates2 = JSON.stringify(newStates) || '';

console.log(newStates2);

// TODO: Must be refactored
if (newStates2 === undefined){
adapter.log.info('State: ' + state + ' Service ID: ' + serviceID + ' Data: ' + JSON.stringify(data));
Expand Down Expand Up @@ -1622,7 +1624,9 @@ function sendCommand(id, cb) {
id = id.replace('.request', '');

adapter.getObject(service, (err, obj) => {

if(obj === null) {
return;
}
let vServiceType = obj.native.serviceType;
let serviceName = obj.native.name;
let device = service.replace(`.${serviceName}`, '');
Expand Down Expand Up @@ -1787,7 +1791,6 @@ function createMessage(sType, aName, _ip, _port, cURL, body, actionID, cb) {
let foundData = body.match(/<[^\/]\w*\s*[^<]*/g);
if (foundData) {
actionID = actionID.replace(/\.request$/, '');

for (let i = foundData.length - 1; i >= 0; i--) {
let foundArgName = foundData[i].match(/<\w*>/);
let strFoundArgName;
Expand Down

0 comments on commit b4dd8e0

Please sign in to comment.