MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / notEntity

Method notEntity

packages/core/src/errors.ts:66–71  ·  view source on GitHub ↗
(owner: AnyEntity, prop: EntityProperty, data: any)

Source from the content-addressed store, hash-verified

64 }
65
66 static notEntity(owner: AnyEntity, prop: EntityProperty, data: any): ValidationError {
67 const type = /\[object (\w+)]/.exec(Object.prototype.toString.call(data))![1].toLowerCase();
68 return new ValidationError(
69 `Entity of type ${prop.type} expected for property ${owner.constructor.name}.${prop.name}, ${inspect(data)} of type ${type} given. If you are using Object.assign(entity, data), use em.assign(entity, data) instead.`,
70 );
71 }
72
73 static notDiscoveredEntity(data: any, meta?: EntityMetadata, action = 'persist'): ValidationError {
74 /* v8 ignore next */

Callers 1

checkMethod · 0.80

Calls 1

inspectFunction · 0.85

Tested by

no test coverage detected