(error: z.ZodError)
| 61 | }) |
| 62 | |
| 63 | function formatFirstIssue(error: z.ZodError): string { |
| 64 | const issue = error.issues[0] |
| 65 | if (!issue) return 'invalid arguments' |
| 66 | const issuePath = issue.path.length > 0 ? `${issue.path.join('.')}: ` : '' |
| 67 | return `${issuePath}${issue.message}` |
| 68 | } |
| 69 | |
| 70 | function getErrorCode(error: unknown): string | undefined { |
| 71 | if (typeof error !== 'object' || error === null) return undefined |