heusalagroup / fi.hg.core

Our enterprise library for TypeScript
MIT License
2 stars 2 forks source link

Improve error logging with database decorators #103

Open EVCareeria opened 1 year ago

EVCareeria commented 1 year ago

We need more precise error logging for database entity decorators.

Such as incorrect entity typing should be more informative. Right now we may get error like: ERROR: TypeError: Could not create entity correctly: [object Object]

thejhh commented 1 year ago

In reality this error happens in EntityUtils.toEntity() because the entity object created was no extended from Entity base class. E.g. the isEntity() check fails.

This utility uses the createEntity() function from the entity metadata to prepare the Entity object. This function is initialized by the use of @Table annotation.

So in order for this error to happen, you would have to have your Entity class not extended from the same Entity class our data framework is using.