Skip to content

Commit 77d0371

Browse files
🐛 Throw if no title
1 parent 3045301 commit 77d0371

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ export const fetchGoogleDocsFiles = async (files: string[]) => {
2323
documentId: documentId.split(":")[0],
2424
auth: oauth2Client,
2525
});
26-
if (!result.data.title) throw new Error("Title not found");
2726
const title = documentId.includes(":")
2827
? documentId.split(":")[1]
2928
: `${result.data.title}.md`;
29+
if (!title) throw new Error("Title not found");
3030
await fs.writeFile(join(".", title), googleDocsToMarkdown(result.data));
3131
console.log("Downloaded document", result.data.title);
3232
} catch (error) {

0 commit comments

Comments
 (0)