Parent bounty: #743
Bug
Several API routes validate request bodies with Zod schemas in controllers, but errorHandler treats thrown ZodErrors as unhandled exceptions. That means malformed client input such as POST /api/jobs with a short title or invalid budget currently returns HTTP 500 instead of a client-facing HTTP 400 validation error.
Expected
- Zod validation failures should return HTTP 400.
- The response should be consistent with the API error shape:
{ success: false, message: ... }.
- Server logs should not classify expected bad client input as an unexpected API error.
Scope
Keep the fix limited to API validation error handling and focused route tests.
This issue is limited only to the creator of this issue. This means that only the issue author can attempt to solve this issue. If you would like to work on it, please create another issue with the same contents and refer to issue #743 for more information.
Parent bounty: #743
Bug
Several API routes validate request bodies with Zod schemas in controllers, but
errorHandlertreats thrownZodErrors as unhandled exceptions. That means malformed client input such asPOST /api/jobswith a short title or invalid budget currently returns HTTP 500 instead of a client-facing HTTP 400 validation error.Expected
{ success: false, message: ... }.Scope
Keep the fix limited to API validation error handling and focused route tests.
This issue is limited only to the creator of this issue. This means that only the issue author can attempt to solve this issue. If you would like to work on it, please create another issue with the same contents and refer to issue #743 for more information.