mirror of
https://github.com/bourquep/mysa-js-sdk.git
synced 2026-02-04 01:31:05 +00:00
fix(example): Provide error object as first arg to rootLogger.error() (#143)
This commit is contained in:
@@ -70,7 +70,7 @@ async function main() {
|
|||||||
`'${device.Name}' status changed: ${status.temperature}°C, ${status.humidity}%, ${watts ?? 'na'}W`
|
`'${device.Name}' status changed: ${status.temperature}°C, ${status.humidity}%, ${watts ?? 'na'}W`
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
rootLogger.error(`Error processing status update for device '${status.deviceId}':`, error);
|
rootLogger.error(error, `Error processing status update for device '${status.deviceId}'`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ async function main() {
|
|||||||
const device = devices.DevicesObj[change.deviceId];
|
const device = devices.DevicesObj[change.deviceId];
|
||||||
rootLogger.info(`'${device.Name}' setpoint changed from ${change.previousSetPoint} to ${change.newSetPoint}`);
|
rootLogger.info(`'${device.Name}' setpoint changed from ${change.previousSetPoint} to ${change.newSetPoint}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
rootLogger.error(`Error processing setpoint update for device '${change.deviceId}':`, error);
|
rootLogger.error(error, `Error processing setpoint update for device '${change.deviceId}'`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ async function main() {
|
|||||||
const device = devices.DevicesObj[change.deviceId];
|
const device = devices.DevicesObj[change.deviceId];
|
||||||
rootLogger.info(change, `'${device.Name}' state changed.`);
|
rootLogger.info(change, `'${device.Name}' state changed.`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
rootLogger.error(`Error processing setpoint update for device '${change.deviceId}':`, error);
|
rootLogger.error(error, `Error processing state update for device '${change.deviceId}'`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user