better error handling

This commit is contained in:
Karl Hudgell 2023-07-24 11:40:12 +01:00
parent f079bb649a
commit 19bd5b3b7b

View File

@ -10,8 +10,7 @@ export default function Component({ service }) {
const { data: jobStats, error: jobStatsError } = useWidgetAPI(widget, "job_stats"); const { data: jobStats, error: jobStatsError } = useWidgetAPI(widget, "job_stats");
if (printerStatsError) { if (printerStatsError) {
let msg const msg = JSON.parse(new Buffer.from(printerStatsError.resultData.data).toString());
msg = JSON.parse(new Buffer.from(printerStatsError.resultData.data).toString());
return ( return (
<Container service={service}> <Container service={service}>
<Block label="OFFLINE" value={msg.error} /> <Block label="OFFLINE" value={msg.error} />