@@ -23,7 +23,7 @@ import { useEffect, useMemo } from 'react';
2323import { DEFAULT_MODEL_MEMORY_LIMIT } from '../../../../../../../common/constants/new_job' ;
2424import { ml } from '../../../../../services/ml_api_service' ;
2525import { JobValidator , VALIDATION_DELAY_MS } from '../../job_validator/job_validator' ;
26- import { ErrorResponse } from '../../../../../../../common/types /errors' ;
26+ import { MLHttpFetchError , MLResponseError } from '../../../../../../../common/util /errors' ;
2727import { useMlKibana } from '../../../../../contexts/kibana' ;
2828import { JobCreator } from '../job_creator' ;
2929
@@ -36,10 +36,10 @@ export const modelMemoryEstimatorProvider = (
3636 jobValidator : JobValidator
3737) => {
3838 const modelMemoryCheck$ = new Subject < CalculatePayload > ( ) ;
39- const error$ = new Subject < ErrorResponse [ 'body' ] > ( ) ;
39+ const error$ = new Subject < MLHttpFetchError < MLResponseError > > ( ) ;
4040
4141 return {
42- get error$ ( ) : Observable < ErrorResponse [ 'body' ] > {
42+ get error$ ( ) : Observable < MLHttpFetchError < MLResponseError > > {
4343 return error$ . asObservable ( ) ;
4444 } ,
4545 get updates$ ( ) : Observable < string > {
@@ -64,7 +64,7 @@ export const modelMemoryEstimatorProvider = (
6464 catchError ( ( error ) => {
6565 // eslint-disable-next-line no-console
6666 console . error ( 'Model memory limit could not be calculated' , error . body ) ;
67- error$ . next ( error . body ) ;
67+ error$ . next ( error ) ;
6868 // fallback to the default in case estimation failed
6969 return of ( DEFAULT_MODEL_MEMORY_LIMIT ) ;
7070 } )
@@ -120,7 +120,8 @@ export const useModelMemoryEstimator = (
120120 title : i18n . translate ( 'xpack.ml.newJob.wizard.estimateModelMemoryError' , {
121121 defaultMessage : 'Model memory limit could not be calculated' ,
122122 } ) ,
123- text : error . message ,
123+ text :
124+ error . body . attributes ?. body . error . caused_by ?. reason || error . body . message || undefined ,
124125 } ) ;
125126 } )
126127 ) ;
0 commit comments