From 7e96816f94314dcdf071eeee6e74a95bcace329f Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 21 May 2022 09:49:26 -0700 Subject: Implement API error handling --- modern/src/main/DevicesList.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'modern/src/main/DevicesList.js') diff --git a/modern/src/main/DevicesList.js b/modern/src/main/DevicesList.js index 4da93547..6ff08c6a 100644 --- a/modern/src/main/DevicesList.js +++ b/modern/src/main/DevicesList.js @@ -164,6 +164,8 @@ const DeviceView = ({ updateTimestamp, onMenuClick, filter }) => { const response = await fetch('/api/devices'); if (response.ok) { dispatch(devicesActions.refresh(await response.json())); + } else { + throw Error(await response.text()); } }, [updateTimestamp]); -- cgit v1.2.3