@punks/backend-entity-manager 0.0.162 → 0.0.164

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -2757,11 +2757,10 @@ exports.EntityManagerRegistry = class EntityManagerRegistry {
2757
2757
  }
2758
2758
  const repositoryInstance = (await app.resolve(repository.discoveredClass.injectType));
2759
2759
  const registration = this.container.registerEntity(entity.meta, repositoryInstance);
2760
- if (!serializer?.discoveredClass?.injectType) {
2761
- throw new Error(`No inject type found for entity serializer: ${entityName}`);
2760
+ if (serializer?.discoveredClass?.injectType) {
2761
+ const serializerInstance = (await app.resolve(serializer.discoveredClass.injectType));
2762
+ registration.addSerializer(serializerInstance);
2762
2763
  }
2763
- const serializerInstance = (await app.resolve(serializer.discoveredClass.injectType));
2764
- registration.addSerializer(serializerInstance);
2765
2764
  if (!queryBuilder.discoveredClass.injectType) {
2766
2765
  throw new Error(`No inject type found for entity query builder: ${entityName}`);
2767
2766
  }
@@ -22556,8 +22555,24 @@ class AppExceptionsFilterBase {
22556
22555
  statusCode: status,
22557
22556
  timestamp: new Date().toISOString(),
22558
22557
  path: request.url,
22558
+ ...(exception
22559
+ ? {
22560
+ type: this.getExceptionType(exception),
22561
+ message: this.getExceptionMessage(exception),
22562
+ stack: this.getExceptionStack(exception),
22563
+ }
22564
+ : {}),
22559
22565
  });
22560
22566
  }
22567
+ getExceptionType(exception) {
22568
+ return exception.constructor?.name;
22569
+ }
22570
+ getExceptionStack(exception) {
22571
+ return exception.stack;
22572
+ }
22573
+ getExceptionMessage(exception) {
22574
+ return exception.message ?? "Internal server error";
22575
+ }
22561
22576
  getErrorStatusCode(exception) {
22562
22577
  const customErrorCode = this.getCustomErrorStatusCode(exception);
22563
22578
  if (customErrorCode) {