From 7256f85a3df54af30a0b37b7f5422be6223fd694 Mon Sep 17 00:00:00 2001 From: Binoy Patel Date: Mon, 29 Jan 2024 19:26:01 -0500 Subject: [PATCH] fix(migration): show proper error message when the file has code issues --- .../_internal/cli/commands/migration/runMigrationCommand.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/sanity/src/_internal/cli/commands/migration/runMigrationCommand.ts b/packages/sanity/src/_internal/cli/commands/migration/runMigrationCommand.ts index d918efe6dd1..dffd1c904a8 100644 --- a/packages/sanity/src/_internal/cli/commands/migration/runMigrationCommand.ts +++ b/packages/sanity/src/_internal/cli/commands/migration/runMigrationCommand.ts @@ -58,7 +58,9 @@ function resolveMigrationScript(workDir: string, migrationName: string) { // eslint-disable-next-line import/no-dynamic-require mod = require(absolutePath) } catch (err) { - // console.error(err) + if (err.code !== 'MODULE_NOT_FOUND') { + throw new Error(`Error: ${err.message}"`) + } } return {relativePath, absolutePath, mod} }),