Skip to content

Commit

Permalink
enhance(build): improve expected document path error message (#11606)
Browse files Browse the repository at this point in the history
feat: better logging

hopefully fixes #11531
  • Loading branch information
PassionPenguin authored Oct 1, 2024
1 parent 9ddf73e commit afa30bc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,10 @@ export async function buildDocument(
};
const { metadata, fileInfo } = document;

if (Document.urlToFolderPath(document.url) !== document.fileInfo.folder) {
const expectedFolderPath = Document.urlToFolderPath(document.url);
if (expectedFolderPath !== document.fileInfo.folder) {
throw new Error(
`The document's slug (${metadata.slug}) doesn't match its disk folder name (${document.fileInfo.folder})`
`The document's slug (${metadata.slug}) doesn't match its disk folder name (${document.fileInfo.folder}): expected path (${expectedFolderPath})`
);
}

Expand Down

0 comments on commit afa30bc

Please sign in to comment.