From 8cf168484364eed85b1a5141fc2ac0649b58a555 Mon Sep 17 00:00:00 2001 From: Leah Bush Date: Tue, 4 Mar 2025 11:45:50 -0600 Subject: [PATCH] feat: add better error logging for content not found --- .../[productSlug]/doc/[version]/[...docsPath]/route.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/api/content/[productSlug]/doc/[version]/[...docsPath]/route.ts b/app/api/content/[productSlug]/doc/[version]/[...docsPath]/route.ts index 1a9d804f0..05c8e1a9e 100644 --- a/app/api/content/[productSlug]/doc/[version]/[...docsPath]/route.ts +++ b/app/api/content/[productSlug]/doc/[version]/[...docsPath]/route.ts @@ -112,7 +112,14 @@ export async function GET(request: Request, { params }: { params: GetParams }) { } if (!foundContent) { - console.error(`API Error: No content found at ${possibleContentLocations}`) + const locationsString = possibleContentLocations.map( + (location: string[]) => { + return `* ${location.join('/')}` + }, + ) + console.error( + `API Error: No content found for ${request.url}\n\nChecked for content at: \n${locationsString.join('\n')}`, + ) return new Response('Not found', { status: 404 }) }