import axios, { AxiosError } from 'axios'; import PrettyJson from './Common/PrettyJSON'; export type ErrorInfo = string | Error | AxiosError | undefined; interface BackendErrorProps { error: ErrorInfo } function DescribeError(error: ErrorInfo) { if (!error) { return
Ошибки отсутствуют
; } else if (typeof error === 'string') { return{error}
; } else if (axios.isAxiosError(error)) { if (!error?.response) { returnНет ответа от сервера
; } if (error.response.status === 404) { return ({`Обращение к несуществующему API`}
Ошибка
{error.message}
{error.response.data && (<>Описание