mirror of
https://github.com/traccar/traccar-web.git
synced 2025-01-07 03:26:42 +08:00
Handle all errors
This commit is contained in:
parent
a78f741473
commit
573f3b148c
@ -21,7 +21,8 @@ const ServerProvider = ({
|
||||
if (response.ok) {
|
||||
dispatch(sessionActions.updateServer(await response.json()));
|
||||
} else {
|
||||
throw Error(await response.text());
|
||||
const message = await response.text();
|
||||
throw Error(message || response.statusText);
|
||||
}
|
||||
} catch (error) {
|
||||
setError(error.message);
|
||||
|
Loading…
Reference in New Issue
Block a user