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