fix(example): Provide error object as first arg to rootLogger.error() (#143)

This commit is contained in:
Pascal Bourque
2025-10-05 11:04:22 -04:00
committed by GitHub
parent ad34fe7486
commit 598edf50d9

View File

@@ -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}'`);
} }
}); });
} }