import { IDictionary } from '../model.header' ; export interface IValidationError < TProps extends IDictionary > extends Error { modelName : string ; errors : { [ key in keyof TProps ] ? : Array < string > ; } ; } type { Object . < string , Array < string > > } name memberof /**
 * Error thrown whenever validation failed during  NohmModel or  NohmModel .
 *
 *  class memberof extends Error export class ValidationError < TProps extends IDictionary > extends Error implements IValidationError < TProps > { public readonly errors : IValidationError < TProps > [ 'errors' ] ; public readonly modelName : string ; constructor ( errors , modelName , errorMessage = 'Validation failed. See .errors on this Error or the Nohm model instance for details.' ) { super ( errorMessage ) ; const emptyErrors = { } ; this . modelName = modelName ; this . errors = Object . keys ( errors ) . reduce < IValidationError < TProps > [ 'errors' ] > ( ( obj , key ) => { const error = errors [ key ] ; if ( error && error . length > 0 ) { obj [ key ] = error ; } return obj ; } , emptyErrors ) ; } }