From 8eb61ef9ffb346779534f4822d88a892b80c582d Mon Sep 17 00:00:00 2001
From: shamoon <4887959+shamoon@users.noreply.github.com>
Date: Mon, 5 Feb 2024 14:46:17 -0800
Subject: [PATCH] Unifi widget: Show a more helpful error if specified site not
 found (#2839)

---
 src/widgets/unifi/component.jsx | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/widgets/unifi/component.jsx b/src/widgets/unifi/component.jsx
index 5ab09999..2d5784b7 100644
--- a/src/widgets/unifi/component.jsx
+++ b/src/widgets/unifi/component.jsx
@@ -20,6 +20,10 @@ export default function Component({ service }) {
     : statsData?.data?.find((s) => s.name === "default");
 
   if (!defaultSite) {
+    if (widget.site) {
+      return <Container service={service} error={{ message: `Site '${widget.site}' not found` }} />;
+    }
+
     return (
       <Container service={service}>
         <Block label="unifi.uptime" />