mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-12-27 07:00:29 +01:00
15 lines
518 B
TypeScript
15 lines
518 B
TypeScript
|
// SPDX-FileCopyrightText: 2023 Andreas Palm
|
||
|
//
|
||
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||
|
|
||
|
import {AxiosError} from 'axios';
|
||
|
|
||
|
export function AlertErrorHandler(error: AxiosError) {
|
||
|
if (error.response === undefined || error.response.status >= 500) {
|
||
|
console.log('Unknown error on axios request', error);
|
||
|
alert('Unerwarteter Fehler, weitere Hinweise ggf. in der JavaScript-Konsole');
|
||
|
} else {
|
||
|
console.log('ClientError on axios request', error);
|
||
|
alert(error.response.data);
|
||
|
}
|
||
|
}
|