diff --git a/src/schemas/post.spec.ts b/src/schemas/post.spec.ts index 5021f60..652f941 100644 --- a/src/schemas/post.spec.ts +++ b/src/schemas/post.spec.ts @@ -364,6 +364,7 @@ describe("post", () => { if (result.success) { throw new Error("Expected error"); } + expect(JSON.stringify(result.error)).toEqual( expect.stringMatching(/comment syntax error/), ); diff --git a/src/schemas/post.ts b/src/schemas/post.ts index f386ee6..d3a33b3 100644 --- a/src/schemas/post.ts +++ b/src/schemas/post.ts @@ -34,7 +34,7 @@ export const post = z message: `Failed to parse post ${url}`, code: ZodIssueCode.custom, params: { - error, + error: error instanceof Error ? error.message : "Unknown error", }, }); return z.NEVER;