From 0bd4d821a9fdec000cf0a8361f40183cbdd4224d Mon Sep 17 00:00:00 2001 From: ainouzgali Date: Wed, 8 May 2024 20:49:19 +0300 Subject: [PATCH 1/2] fix: guard does not fit error --- .../compile-template/compile-template.usecase.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/application-generic/src/usecases/compile-template/compile-template.usecase.ts b/packages/application-generic/src/usecases/compile-template/compile-template.usecase.ts index bc4370c0812..8c3673d7448 100644 --- a/packages/application-generic/src/usecases/compile-template/compile-template.usecase.ts +++ b/packages/application-generic/src/usecases/compile-template/compile-template.usecase.ts @@ -214,12 +214,10 @@ export class CompileTemplate { const template = Handlebars.compile(templateContent); result = template(command.data, {}); - } catch (e: unknown) { - let errorMessage = `Message content could not be generated`; - if (checkIsResponseError(e)) { - errorMessage = e.message; - } - throw new ApiException(errorMessage); + } catch (e: any) { + throw new ApiException( + e?.message || `Message content could not be generated` + ); } return result.replace(/'/g, "'"); From acd61c91f18c45d8ba17baaef52917bac83fd547 Mon Sep 17 00:00:00 2001 From: ainouzgali Date: Wed, 8 May 2024 20:53:30 +0300 Subject: [PATCH 2/2] feat: remove unused import --- .../src/usecases/compile-template/compile-template.usecase.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/application-generic/src/usecases/compile-template/compile-template.usecase.ts b/packages/application-generic/src/usecases/compile-template/compile-template.usecase.ts index 8c3673d7448..31707e10b7d 100644 --- a/packages/application-generic/src/usecases/compile-template/compile-template.usecase.ts +++ b/packages/application-generic/src/usecases/compile-template/compile-template.usecase.ts @@ -1,7 +1,7 @@ import { Injectable } from '@nestjs/common'; import * as Handlebars from 'handlebars'; import { format } from 'date-fns'; -import { checkIsResponseError, HandlebarHelpersEnum } from '@novu/shared'; +import { HandlebarHelpersEnum } from '@novu/shared'; import { CompileTemplateCommand } from './compile-template.command'; import * as i18next from 'i18next';