@punks/backend-entity-manager 0.0.163 → 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
@@ -22547,8 +22547,24 @@ class AppExceptionsFilterBase {
22547
22547
  statusCode: status,
22548
22548
  timestamp: new Date().toISOString(),
22549
22549
  path: request.url,
22550
+ ...(exception
22551
+ ? {
22552
+ type: this.getExceptionType(exception),
22553
+ message: this.getExceptionMessage(exception),
22554
+ stack: this.getExceptionStack(exception),
22555
+ }
22556
+ : {}),
22550
22557
  });
22551
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
+ }
22552
22568
  getErrorStatusCode(exception) {
22553
22569
  const customErrorCode = this.getCustomErrorStatusCode(exception);
22554
22570
  if (customErrorCode) {