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/settings/DriversPage.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'modern/src/settings/DriversPage.js') diff --git a/modern/src/settings/DriversPage.js b/modern/src/settings/DriversPage.js index f5908381..26601777 100644 --- a/modern/src/settings/DriversPage.js +++ b/modern/src/settings/DriversPage.js @@ -26,6 +26,8 @@ const DriversView = ({ updateTimestamp, onMenuClick }) => { const response = await fetch('/api/drivers'); if (response.ok) { setItems(await response.json()); + } else { + throw Error(await response.text()); } }, [updateTimestamp]); -- cgit v1.2.3