import { EuiEmptyPrompt , EuiText } from '@elastic/eui' ; import React from 'react' ; interface VisualizationNoResultsProps { onInit ? : ( ) => void ; error : string | Error ; } export class VisualizationError extends React . Component < VisualizationNoResultsProps > { public render ( ) { return ( < EuiEmptyPrompt iconType = "alert" iconColor = "danger" data - test - subj = "visualization-error" body = { < EuiText size = "xs" > { typeof this . props . error === 'string' ? this . props . error : this . props . error . message } < /EuiText>}/ > ) ; } public componentDidMount ( ) { this . afterRender ( ) ; } public componentDidUpdate ( ) { this . afterRender ( ) ; } private afterRender ( ) { if ( this . props . onInit ) { this . props . onInit ( ) ; } } } export default VisualizationError ;