import { RequestError } from '@tinkoff/request-core' ; import { HttpRequestError , TimeoutError , AbortError } from './errors' ; export const isHttpError = ( error ) : error is HttpRequestError => { return error . code === 'ERR_HTTP_ERROR' ; } ; export const isTimeoutError = ( error ) : error is TimeoutError => { return error . code === 'ERR_HTTP_REQUEST_TIMEOUT' ; } ; export const isAbortError = ( error ) : error is AbortError => { return error . code === 'ABORT_ERR' ; } ; export const isNetworkFail = ( error ) => { return isTimeoutError ( error ) || ( isHttpError ( error ) && ! error . status ) ; } ; export const isServerError = ( error ) => { return isHttpError ( error ) && error . status >= 500 ; } ;