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