import { MLErrorObject , ErrorType } from './types' ; export class MLRequestFailure extends Error { constructor ( error , resp ) { super ( error . message ) ; Object . setPrototypeOf ( this , new . target . prototype ) ; if ( typeof resp !== 'string' && typeof resp !== 'undefined' ) { if ( 'body' in resp ) { this . stack = JSON . stringify ( resp . body , null , 2 ) ; } else { try { this . stack = JSON . stringify ( resp , null , 2 ) ; } catch ( e ) { } } } } }