From b7cc83300a880dcac40f19123421483b05500876 Mon Sep 17 00:00:00 2001 From: Albert Lai Date: Mon, 13 Jan 2025 17:46:03 -0800 Subject: [PATCH] fix: remove custom error --- .../internal-non-workflow/data-converter-helpers.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/packages/common/src/internal-non-workflow/data-converter-helpers.ts b/packages/common/src/internal-non-workflow/data-converter-helpers.ts index 258ed89ad..5e99ce79b 100644 --- a/packages/common/src/internal-non-workflow/data-converter-helpers.ts +++ b/packages/common/src/internal-non-workflow/data-converter-helpers.ts @@ -1,7 +1,7 @@ import { PayloadConverter, defaultPayloadConverter } from '../converter/payload-converter'; import { DataConverter, defaultFailureConverter, LoadedDataConverter } from '../converter/data-converter'; import { FailureConverter } from '../converter/failure-converter'; -import { errorCode, hasOwnProperty, isRecord } from '../type-helpers'; +import { hasOwnProperty, isRecord } from '../type-helpers'; import { ValueError } from '../errors'; const isValidPayloadConverter = (converter: unknown, path: string): asserts converter is PayloadConverter => { @@ -35,15 +35,7 @@ function requireConverter( type: string, validator: (converter: unknown, path: string) => asserts converter is T ): T { - let module; - try { - module = require(path); // eslint-disable-line @typescript-eslint/no-require-imports - } catch (error) { - if (errorCode(error) === 'MODULE_NOT_FOUND') { - throw new ValueError(`Could not find a file at the specified ${type}Path: '${path}'.`); - } - throw error; - } + const module = require(path); // eslint-disable-line @typescript-eslint/no-require-imports if (isRecord(module) && hasOwnProperty(module, type)) { const converter = module[type];