Join the discussion on Telegram
Why this matters
backend/src/middleware/error.middleware.ts line 10:
export const errorHandler = (
err: any,
req: Request,
...
And line 21: err.issues.map((e: any) => ({ ... })).
any here is the typical Express error-handler gotcha. Replacing with unknown and narrowing (err instanceof Error, err instanceof ZodError, err instanceof Prisma.PrismaClientKnownRequestError) tightens the type. The Zod issue mapping should use ZodIssue.
Acceptance criteria
Files to touch
backend/src/middleware/error.middleware.ts (lines 10, 21)
Out of scope
- Removing
any from app.ts global CORS error handler (separate issue)
Join the discussion on Telegram
Why this matters
backend/src/middleware/error.middleware.tsline 10:And line 21:
err.issues.map((e: any) => ({ ... })).anyhere is the typical Express error-handler gotcha. Replacing withunknownand narrowing (err instanceof Error,err instanceof ZodError,err instanceof Prisma.PrismaClientKnownRequestError) tightens the type. The Zod issue mapping should useZodIssue.Acceptance criteria
err: anytoerr: unknownand narrow before each access.map((e: any) => ...)callback asZodIssuenpm run buildstill passesFiles to touch
backend/src/middleware/error.middleware.ts(lines 10, 21)Out of scope
anyfromapp.tsglobal CORS error handler (separate issue)