HonoH
Hono10mo ago
Phantom

Update the default validator to return custom error response

hey guys, I want to update the default zValidator of hono to return custom error objects. Right now, it returns something like this:
{
  "success": false,
  "error": {
    "issues": [
      {
        "validation": "email",
        "code": "invalid_string",
        "message": "Invalid email",
        "path": [
          "email"
        ]
      }
    ],
    "name": "ZodError"
  }
}


but I want it to return {message:"message"}
Was this page helpful?