import { cnst_CANCEL_ERROR } from '../consts';
import { getErrorMessageAsText } from '../utils';

export class ResultSubject {
  result = false;
  errMsg?;
  entity?: any;
  constructor(error: any, entity: any, prefix: string = '') {
    this.errMsg = getErrorMessageAsText(error);
    if ( this.errMsg !== cnst_CANCEL_ERROR && this.errMsg.indexOf(prefix) === -1) this.errMsg = prefix + this.errMsg;
    this.entity = entity;
  }

}
