@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.
@@ -6,6 +6,9 @@ export interface RuntimeErrorInformation {
6
6
  }
7
7
  export declare abstract class AppExceptionsFilterBase implements ExceptionFilter {
8
8
  catch(exception: unknown, host: ArgumentsHost): void;
9
+ protected getExceptionType(exception: any): any;
10
+ protected getExceptionStack(exception: any): any;
11
+ protected getExceptionMessage(exception: any): any;
9
12
  protected getErrorStatusCode(exception: any): number;
10
13
  protected abstract logError(info: RuntimeErrorInformation): Promise<void>;
11
14
  protected abstract getCustomErrorStatusCode(exception: any): number | undefined;
package/dist/esm/index.js CHANGED
@@ -2749,11 +2749,10 @@ let EntityManagerRegistry = class EntityManagerRegistry {
2749
2749
  }
2750
2750
  const repositoryInstance = (await app.resolve(repository.discoveredClass.injectType));
2751
2751
  const registration = this.container.registerEntity(entity.meta, repositoryInstance);
2752
- if (!serializer?.discoveredClass?.injectType) {
2753
- throw new Error(`No inject type found for entity serializer: ${entityName}`);
2752
+ if (serializer?.discoveredClass?.injectType) {
2753
+ const serializerInstance = (await app.resolve(serializer.discoveredClass.injectType));
2754
+ registration.addSerializer(serializerInstance);
2754
2755
  }
2755
- const serializerInstance = (await app.resolve(serializer.discoveredClass.injectType));
2756
- registration.addSerializer(serializerInstance);
2757
2756
  if (!queryBuilder.discoveredClass.injectType) {
2758
2757
  throw new Error(`No inject type found for entity query builder: ${entityName}`);
2759
2758
  }
@@ -22548,8 +22547,24 @@ class AppExceptionsFilterBase {
22548
22547
  statusCode: status,
22549
22548
  timestamp: new Date().toISOString(),
22550
22549
  path: request.url,
22550
+ ...(exception
22551
+ ? {
22552
+ type: this.getExceptionType(exception),
22553
+ message: this.getExceptionMessage(exception),
22554
+ stack: this.getExceptionStack(exception),
22555
+ }
22556
+ : {}),
22551
22557
  });
22552
22558
  }
22559
+ getExceptionType(exception) {
22560
+ return exception.constructor?.name;
22561
+ }
22562
+ getExceptionStack(exception) {
22563
+ return exception.stack;
22564
+ }
22565
+ getExceptionMessage(exception) {
22566
+ return exception.message ?? "Internal server error";
22567
+ }
22553
22568
  getErrorStatusCode(exception) {
22554
22569
  const customErrorCode = this.getCustomErrorStatusCode(exception);
22555
22570
  if (customErrorCode) {