From fb39fb585430573774f0f12bf7d7c82425510b62 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Sun, 27 Dec 2020 22:32:26 +0100 Subject: [PATCH] fixing ErrorDTO during request saving --- src/common/entities/Error.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/common/entities/Error.ts b/src/common/entities/Error.ts index 7f2fe0c4..38c8dc43 100644 --- a/src/common/entities/Error.ts +++ b/src/common/entities/Error.ts @@ -33,10 +33,12 @@ export class ErrorDTO { constructor(public code: ErrorCodes, public message?: string, public details?: any, req?: Request) { this.detailsStr = (this.details ? this.details.toString() : '') || ErrorCodes[code]; - this.request = { - method: req.method, - url: req.url - }; + if (req) { + this.request = { + method: req.method, + url: req.url + }; + } } toString(): string {