diff --git a/packages/plugs/core/link.ts b/packages/plugs/core/link.ts index 727c6b9..7c26d7d 100644 --- a/packages/plugs/core/link.ts +++ b/packages/plugs/core/link.ts @@ -58,7 +58,11 @@ export async function titleUnfurlOptions(url: string): Promise { // Run on the server because plugs will likely rely on fetch for this export async function unfurlExec(id: string, url: string): Promise { let replacement = await dispatchEvent(`unfurl:${id}`, url); - return replacement[0]; + if (replacement.length === 0) { + throw new Error("Unfurl failed"); + } else { + return replacement[0]; + } } const titleRegex = /]*>\s*([^<]+)\s*<\/title\s*>/i;