From 6579b82e346dc689f2e57da0ecead142a8048b24 Mon Sep 17 00:00:00 2001 From: Konotorii <79553360+konotorii@users.noreply.github.com> Date: Sun, 11 Aug 2024 13:09:34 -0400 Subject: [PATCH] fix: Wrapped props set in try catch to avoid any errors that may happen because of undefined parameters --- src/utility/src/logger.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/utility/src/logger.ts b/src/utility/src/logger.ts index a1dcf85..bb01365 100644 --- a/src/utility/src/logger.ts +++ b/src/utility/src/logger.ts @@ -26,11 +26,20 @@ class Logger { log_file: string constructor(process: string, props?: LoggerProps) { - this.props = { - outputFile: props.outputFile ? props.outputFile : undefined, - filePath: props.filePath ? props.filePath : "", - outputJson: props.outputJson ? props.outputJson : undefined, + try { + this.props = { + outputFile: props.outputFile ? props.outputFile : false, + filePath: props.filePath ? props.filePath : "", + outputJson: props.outputJson ? props.outputJson : false, + } + } catch (e) { + this.props = { + outputFile: false, + filePath: "", + outputJson: false, + } } + this.process = process this.log_file = `${DateTime.now().toFormat("HH mm ss dd LL yyyy")}.log`; }