From 541b6061ee7bf0d74c0d1df6dfabb69cd0b09f6b Mon Sep 17 00:00:00 2001 From: Mateusz Kadlubowski Date: Fri, 13 Dec 2024 23:36:57 +0800 Subject: [PATCH] apply feedback --- src/indexer/index.ts | 2 +- src/utils/error/legacy-api/index.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/indexer/index.ts b/src/indexer/index.ts index f897a4e..9913260 100644 --- a/src/indexer/index.ts +++ b/src/indexer/index.ts @@ -39,7 +39,7 @@ export const createIndexer = (legacyTemplate: boolean): Indexer => ({ error instanceof GetDefineMetaFirstArgumentError ) { const { filename } = error; - throw new LegacyTemplateNotEnabledError(filename); + throw new LegacyTemplateNotEnabledError(filename, { cause: error }); } // WARN: We can't use `instanceof StorybookSvelteCSFError`, because is an _abstract_ class diff --git a/src/utils/error/legacy-api/index.ts b/src/utils/error/legacy-api/index.ts index b678346..34a9a6e 100644 --- a/src/utils/error/legacy-api/index.ts +++ b/src/utils/error/legacy-api/index.ts @@ -36,8 +36,9 @@ export class LegacyTemplateNotEnabledError extends StorybookSvelteCSFError { readonly code = 2; public documentation = true; - constructor(filename?: string) { + constructor(filename?: string, options?: ConstructorParameters[1]) { super({ filename }); + this.cause = options?.cause; } template(): string {