MCPcopy
hub / github.com/t3-oss/create-t3-app / formatErrors

Function formatErrors

template/base/src/env/client.mjs:6–15  ·  view source on GitHub ↗
(
  /** @type {import('zod').ZodFormattedError<Map<string,string>,string>} */
  errors,
)

Source from the content-addressed store, hash-verified

4const _clientEnv = clientSchema.safeParse(clientEnv);
5
6export const formatErrors = (
7 /** @type {import('zod').ZodFormattedError<Map<string,string>,string>} */
8 errors,
9) =>
10 Object.entries(errors)
11 .map(([name, value]) => {
12 if (value && "_errors" in value)
13 return `${name}: ${value._errors.join(", ")}\n`;
14 })
15 .filter(Boolean);
16
17if (_clientEnv.success === false) {
18 console.error(

Callers 2

server.mjsFile · 0.90
client.mjsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected