Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,11 @@ export default async function () {
// ignore
exitCode = e.exitCode
} else if (e instanceof CliError) {
telemetry.trackError(e)
console.error(red(e.message))
} else {
if (e instanceof Error) {
telemetry.trackError(e)
console.error(red(`Unhandled error: ${e.message}`))
} else {
telemetry.trackError(new Error(String(e)))
console.error(red(`Unhandled error: ${String(e)}`))
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/zmodel-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function loadPrismaConfig(schemaDir: string): string | null {
const config = configFn(env)
return config?.datasource?.url
} catch (error) {
if (error instanceof Error && error.message.includes('Environment variable')) {
if (error instanceof Error) {
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change removes the specific check for 'Environment variable' errors, causing all Error instances to be re-thrown. This means any error during config parsing (like syntax errors) will now crash the application instead of logging a warning and returning null. The original logic allowed graceful fallback for non-environment-variable errors. Consider keeping the specific error message check or using a custom error type for environment variable errors to maintain the fallback behavior.

Suggested change
if (error instanceof Error) {
if (error instanceof CliError && typeof error.message === 'string' && error.message.startsWith('Environment variable')) {
// Propagate environment-variable-related configuration errors

Copilot uses AI. Check for mistakes.
throw error
}
console.warn(`Warning: Failed to parse prisma.config.ts: ${error}`)
Expand Down Expand Up @@ -144,7 +144,7 @@ function parseDatasource(
// If still no URL found, throw error
if (url == null) {
throw new CliError(
'No datasource URL found. For Prisma 7, ensure prisma.config.ts exists with datasource configuration, or provide the URL via -d option.'
'No datasource URL found. For Prisma 7, ensure prisma.config.ts exists with datasource configuration or directly provide the URL via -d option.'
)
}
}
Expand Down
Loading