import { i18n } from '@kbn/i18n' ; import { IHttpFetchError , ResponseErrorBody } from 'kibana/public' ; export function formatHttpError ( error ) { if ( ! error . response ) { return i18n . translate ( 'xpack.graph.fatalError.unavailableServerErrorMessage' , { defaultMessage : 'An HTTP request has failed to connect. ' + 'Please check if the Kibana server is running and that your browser has a working connection, ' + 'or contact your system administrator.' , } ) ; } return i18n . translate ( 'xpack.graph.fatalError.errorStatusMessage' , { defaultMessage : 'Error {errStatus} {errStatusText}: {errMessage}' , values : { errStatus : error . body ?. status , errStatusText : error . body ?. statusText , errMessage : error . body ?. message , } , } ) ; }