Skip to content

Commit 9ec9a20

Browse files
author
陈家名
committed
fix: improve environment validation error messages
- Add console.error output before throwing validation errors - Include specific error details in the thrown error message - Makes debugging environment configuration issues easier
1 parent 1c247d8 commit 9ec9a20

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

common/src/env.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { clientEnvSchema, clientProcessEnv } from './env-schema'
22

33
const parsedEnv = clientEnvSchema.safeParse(clientProcessEnv)
44
if (!parsedEnv.success) {
5-
throw parsedEnv.error
5+
console.error('Environment validation failed:', parsedEnv.error.errors)
6+
throw new Error(`Invalid environment configuration: ${parsedEnv.error.message}`)
67
}
78

89
export const env = parsedEnv.data

0 commit comments

Comments
 (0)