Skip to content

Commit

Permalink
throw error if exclusive relationship missing
Browse files Browse the repository at this point in the history
  • Loading branch information
3mcd committed Feb 25, 2025
1 parent f3ec8a4 commit 542503f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/lib/server/pub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2246,5 +2246,5 @@ export const getExclusivelyRelatedPub = async (relatedPubId: PubsId, relationFie
).as("values"),
pubType({ eb, pubTypeIdRef: "pubs.pubTypeId" }),
])
).executeTakeFirstOrThrow();
).executeTakeFirst();
};
6 changes: 3 additions & 3 deletions core/lib/server/render/pub/renderMarkdownWithPub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,9 @@ const renderMarkdownWithPubPlugin: Plugin<[utils.RenderWithPubContext]> = (conte
const directiveName = node.name.toLowerCase() as RenderWithPubToken;
const directiveVisitor = directiveVisitors[directiveName];
const { rel, ...attrs } = expect(node.attributes);
const relatedPub = await getExclusivelyRelatedPub(
context.pub.id as PubsId,
rel
const relatedPub = expect(
await getExclusivelyRelatedPub(context.pub.id as PubsId, rel),
`The email template included a directive containing rel="${rel}", but the pub is not related to any other pubs through this field.`
);
node.attributes = attrs;
directiveVisitor(node, {
Expand Down

0 comments on commit 542503f

Please sign in to comment.