mirror of
https://github.com/wowlikon/LiB.git
synced 2026-02-04 04:31:09 +00:00
Страница 404, более подробная инофрмация об ошибках, улучшение фронтэнда и логирования, исправление docker-compose
This commit is contained in:
@@ -112,11 +112,18 @@ const Api = {
|
||||
|
||||
if (!response.ok) {
|
||||
const errorData = await response.json().catch(() => ({}));
|
||||
throw new Error(
|
||||
errorData.detail ||
|
||||
errorData.error_description ||
|
||||
`Ошибка ${response.status}`,
|
||||
);
|
||||
const error = new Error("API Error");
|
||||
Object.assign(error, errorData);
|
||||
|
||||
if (typeof errorData.detail === "string") {
|
||||
error.message = errorData.detail;
|
||||
} else if (errorData.error_description) {
|
||||
error.message = errorData.error_description;
|
||||
} else if (!errorData.detail) {
|
||||
error.message = `Ошибка ${response.status}`;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
return response.json();
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user