Skip to content

Commit

Permalink
extract message from error thrown by expost
Browse files Browse the repository at this point in the history
  • Loading branch information
narthur committed Jul 16, 2024
1 parent 72d7483 commit d5b29de
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/schemas/post.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/),
);
Expand Down
2 changes: 1 addition & 1 deletion src/schemas/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d5b29de

Please sign in to comment.